/*
EMV鏁版嵁缁撴瀯瑙ｆ瀽
AIP 2瀛楄妭 搴旂敤浜や簰鐗瑰緛
	瀛楄妭 1:
		bit 8: 1 = RFU
		bit 7: 1 = 鏀寔SDA
		bit 6: 1 = 鏀寔DDA
		bit 5: 1 = 鏀寔鎸佸崱浜鸿璇�
		bit 4: 1 = 鎵ц缁堢椋庨櫓绠＄悊
		bit 3: 1 = 鏀寔鍙戝崱琛岃璇�
		bit 2: RFU (0)
		bit 1: 1 = 鏀寔CDA
		瀛楄妭2: RFU ("00")
			
AFL 4瀛楄妭 搴旂敤鏂囦欢瀹氫綅鍣�
    瀛楄妭1:鐭枃浠舵爣璇嗙. SFCXXXXX
    瀛楄妭2:鏂囦欢涓璇诲彇鐨勭涓�涓褰曠殑璁板綍鍙�
    瀛楄妭3:鏂囦欢涓璇诲彇鐨勬渶鍚庣涓�涓褰曠殑璁板綍鍙�
    瀛楄妭4:浠庣涓�涓褰曞紑濮嬬殑鐢ㄤ簬鑴辨満鏁版嵁璁よ瘉鐨勮繛缁褰曟暟
    	
AFLNUM 1瀛楄妭.璁板綍涓暟

TermInfo.TVR[5]	//缁堢楠岃瘉缁撴灉
		b8  b7  b6  b5  b4  b3  b2  b1
	TVR[0]:		
		1	X	x	x	x	x	x	x	鏈繘琛岃劚鏈烘暟鎹璇�
		x	1	x	x	x	x	x	x	鑴辨満闈欐�佹暟鎹璇佸け璐�
		x	X	1	x	x	x	x	x	IC鍗℃暟鎹己澶�
		x	X	x	1	x	x	X	x	鍗＄墖鍑虹幇鍦ㄧ粓绔紓甯告枃浠朵腑
		x	X	x	x	1	x	X	x	鑴辨満鍔ㄦ�佹暟鎹璇佸け璐�
		x	X	x	x	x	1	X	x	澶嶅悎鍔ㄦ�佹暟鎹璇�/搴旂敤瀵嗙爜鐢熸垚澶辫触
		x	X	x	x	x	x	0	x	RFU
		x	X	x	x	x	x	X	0	RFU
	TVR[1]:
		1	X	x	x	x	x	X	x	IC鍗″拰缁堢搴旂敤鐗堟湰涓嶄竴鑷�
		x	1	x	x	x	x	X	x	搴旂敤宸茶繃鏈�
		x	X	1	x	x	x	X	x	搴旂敤灏氭湭鐢熸晥
		x	X	x	1	x	x	X	x	鍗＄墖涓嶅厑璁告墍璇锋眰鐨勬湇鍔�
		x	X	x	x	1	x	X	x	鏂板崱
		x	X	x	x	x	0	X	x	RFU
		x	X	x	x	x	x	0	x	RFU
		x	X	x	x	x	x	X	0	RFU
	TVR[2]:
		1	X	x	x	x	x	x	x	鎸佸崱浜洪獙璇佸け璐�
		x	1	x	x	x	x	x	x	鏈煡鐨凜VM
		x	X	1	x	x	x	x	X	PIN閲嶈瘯娆℃暟瓒呴檺
		x	X	x	1	x	x	x	X	瑕佹眰杈撳叆PIN锛屼絾瀵嗙爜閿洏涓嶅瓨鍦ㄦ垨宸ヤ綔涓嶆甯�
		x	X	x	x	1	x	x	X	瑕佹眰杈撳叆PIN锛屽瘑鐮侀敭鐩樺瓨鍦紝浣嗘湭杈撳叆PIN
		x	X	x	x	x	1	x	X	杈撳叆鑱旀満PIN
		x	X	x	x	x	x	0	X	RFU
		x	X	x	x	x	x	x	0	RFU
	TVR[3]:
		1	X	x	X	x	X	x	X	浜ゆ槗瓒呰繃鏈�浣庨檺棰�
		x	1	x	X	x	X	x	X	瓒呰繃杩炵画鑴辨満浜ゆ槗涓嬮檺
		x	X	1	X	x	X	x	X	瓒呰繃杩炵画鑴辨満浜ゆ槗涓婇檺
		x	X	x	1	x	X	x	X	浜ゆ槗琚殢鏈洪�夋嫨鑱旀満澶勭悊
		x	X	x	X	1	X	x	X	鍟嗘埛瑕佹眰鑱旀満浜ゆ槗
		x	X	x	X	x	0	x	X	RFU
		x	X	x	X	x	X	0	X	RFU
		x	X	x	X	x	X	x	0	RFU
	TVR[4]:
		1	X	x	x	x	X	x	X	浣跨敤缂虹渷TDOL
		x	1	x	x	x	X	x	X	鍙戝崱琛岃璇佸け璐�
		x	X	1	x	x	X	x	X	鏈�鍚庝竴娆ENERATE AC鍛戒护涔嬪墠鑴氭湰澶勭悊澶辫触
		x	X	x	1	x	X	x	X	鏈�鍚庝竴娆ENERATE AC鍛戒护涔嬪悗鑴氭湰澶勭悊澶辫触
		x	X	x	x	0	X	x	X	RFU
		x	X	x	x	x	0	x	X	RFU
		x	X	x	x	x	X	0	X	RFU
		x	X	x	x	x	X	x	0	RFU
		
TermInfo.TSI[2]:浜ゆ槗鐘舵�佷俊鎭�(TSI)
	TSI[0]:
		1	X	x	x	X	x	X	x	鑴辨満鏁版嵁璁よ瘉宸茶繘琛�
		x	1	x	x	X	x	X	x	鎸佸崱浜洪獙璇佸凡杩涜
		x	X	1	x	X	x	X	x	鍗＄墖椋庨櫓绠＄悊宸茶繘琛�
		x	X	x	1	X	x	X	x	鍙戝崱琛岃璇佸凡杩涜
		x	X	x	x	1	x	X	x	缁堢椋庨櫓绠＄悊宸茶繘琛�
		x	X	x	x	X	1	X	x	鑴氭湰澶勭悊宸茶繘琛�
		x	X	x	x	X	x	0	x	RFU
		x	X	x	x	x	x	X	0	RFU
	TSI[1]:
		0	X	x	x	x	X	X	x	RFU
		x	0	x	x	x	X	X	x	RFU
		x	X	0	x	x	X	X	x	RFU
		x	X	x	0	x	X	X	x	RFU
		x	X	x	x	0	X	X	x	RFU
		x	X	x	x	x	0	X	x	RFU
		x	X	x	x	x	X	0	x	RFU
		x	X	x	x	x	x	X	0	RFU
		
CVM鍒楄〃鏁版嵁鏍煎紡锛�
	瀛楄妭1-4锛氶噾棰漍(浜岃繘鍒�)
	瀛楄妭5-8锛氶噾棰漎(浜岃繘鍒�)
	瀛楄妭9:(CVM CODE)
		bit 8: 0=鍙湁绗﹀悎姝よ鑼冪殑鍙栧��(濡傛灉涓嶄负1,璇存槑鏈夎嚜瀹氫箟鐨勫��)
		bit 7: 1=濡傛灉姝VM澶辫触,搴旂敤鍚庣画鐨�
			   0=濡傛灉姝VM澶辫触,鍒欐寔鍗′汉楠岃瘉澶辫触
		bit 6-1:
		000000 = CVM澶辫触澶勭悊
		000001 = 鍗＄墖鎵ц鏄庢枃PIN鏍稿
		000010 = 鑱旀満鍔犲瘑PIN楠岃瘉
		000011 = 鍗＄墖鎵ц鏄庢枃PIN鏍稿+绛惧悕(绾镐笂)
		000100 = EMV淇濈暀//V4.1淇敼鎴愯劚鍙婂姞瀵嗙殑PIN鏍稿
		000101 = EMV淇濈暀//V4.1淇敼鎴愯劚鏈哄姞瀵嗙殑PIN鏍稿+绛惧悕
		011110 = 绛惧悕(绾镐笂)
		011111 = 涓嶉渶CVM
		000110-011101 = 淇濈暀缁欏姞鍏ョ殑鏀粯绯荤粺
		100000-101111 = 淇濈暀缁欏悇鑷嫭绔嬬殑鏀粯绯荤粺
		110000-111110 = 淇濈暀缁欏彂鍗¤
		111111 = RFU
		PBOC瀹氫箟:
		100000 = 鎸佸崱浜鸿瘉浠跺嚭绀�
	瀛楄妭10(CVM Condition Code):
		00-鎬绘槸
		01-濡傛灉鏄疉TM鐜伴噾浜ゆ槗
		02-濡傛灉涓嶆槸ATM鐜伴噾鎴栨湁浜哄�煎畧鐜伴噾鎴栬繑鐜颁氦鏄�
		03-濡傛灉缁堢鏀寔杩欎釜CVM
		04-濡傛灉鏄汉宸ュ�煎畧鐜伴噾浜ゆ槗
		05-濡傛灉鏄繑鐜颁氦鏄�
		06-濡傛灉浜ゆ槗璐у竵绛変簬搴旂敤璐у竵鐮佸苟涓斿皬浜嶺鍊�
		07-濡傛灉浜ゆ槗璐у竵绛変簬搴旂敤璐у竵鐮佸苟涓斿ぇ浜嶺鍊�
		08-濡傛灉浜ゆ槗璐у竵绛変簬搴旂敤璐у竵鐮佸苟涓斿皬浜嶻鍊�
		09-濡傛灉浜ゆ槗璐у竵绛変簬搴旂敤璐у竵鐮佸苟涓斿ぇ浜嶺鍊�
		0A-7F:RFU
		80-FF:RFU 淇濈暀缁欏悇涓敮浠樼郴缁�
	涓嬩竴涓狢VM鐢ㄥ彟澶�2涓狢VM鐮佸拰CVM鏉′欢瀛楄妭琛ㄧず
	
TermInfo.TermCapab[3]//	缁堢鎬ц兘琛� 绋嬪簭榛樿涓� \xE0\xF8\xC8
	TermInfo.TermCapab[0]:瀛楄妭1锛屽崱鐗囨暟鎹緭鍏ユ�ц兘
		B8 B7 B6 B5 B4 B3 B2 B1 
		1  X  X  X  X  X  X	 X 鎵嬪伐閿洏杈撳叆
		X  1  X  X  X  X  X	 X 纾佹潯
		X  X  1  X  X  X  X	 X 鎺ヨЕ寮廔C鍗�
		X  X  X  0  X  X  X	 X RFU
		X  X  X  X  0  X  X	 X RFU
		X  X  X  X  X  0  X	 X RFU
		X  X  X  X  X  X  0	 X RFU
		X  X  X  X  X  X  X	 0 RFU
	TermInfo.TermCapab[1]:瀛楄妭2锛孋VM鎬ц兘
		B8 B7 B6 B5 B4 B3 B2 B1 
		1  X  X  X  X  X  X	 X IC鍗℃槑鏂嘝IN楠岃瘉
		X  1  X  X  X  X  X	 X 鍔犲瘑PIN鑱旀満楠岃瘉
		X  X  1  X  X  X  X	 X 绛惧悕(绾�)
		X  X  X  1  X  X  X	 X 鑴辨満鍔犲瘑PIN
		X  X  X  X  1  X  X	 X 鏃犻渶CVM
		X  X  X  X  X  0  X	 X RFU
		X  X  X  X  X  X  0	 X RFU
		X  X  X  X  X  X  X	 1 鎸佸崱浜鸿瘉浠堕獙璇�
	TermInfo.TermCapab[2]:瀛楄妭3锛屽畨鍏ㄦ�ц兘
		B8 B7 B6 B5 B4 B3 B2 B1 
		1  X  X  X  X  X  X	 X 闈欐�佹暟鎹璇丼DA
		X  1  X  X  X  X  X	 X 鍔ㄦ�佹暟鎹璇丏DA
		X  X  1  X  X  X  X	 X 鍚炲崱
		X  X  X  1  X  X  X	 X 澶嶅悎鏁版嵁璁よ瘉/搴旂敤瀵嗙爜鐢熸垚CDA
		X  X  X  X  0  X  X	 X RFU
		X  X  X  X  X  0  X	 X RFU
		X  X  X  X  X  X  0	 X RFU
		X  X  X  X  X  X  X	 0 RFU
	
TermInfo.TermAddCapab[5]//	闄勫姞缁堢鎬ц兘琛�
	//榛樿鍙傛暟锛歺FF\x00\xF0\xB0\x01
	TermInfo.TermAddCapab[4]:瀛楄妭1锛屼氦鏄撶被鍨嬫�ц兘
		B8 B7 B6 B5 B4 B3 B2 B1 
		1  X  X  X  X  X  X	 X 鐜伴噾
		X  1  X  X  X  X  X	 X 鍟嗗搧
		X  X  1  X  X  X  X	 X 鏈嶅姟
		X  X  X  1  X  X  X	 X 杩旂幇
		X  X  X  X  1  X  X	 X 鏌ヨ
		X  X  X  X  X  1  X	 X 杞笎
		X  X  X  X  X  X  1	 X 浠樻
		X  X  X  X  X  X  X	 1 绠＄悊
	TermInfo.TermAddCapab[3]:瀛楄妭2锛屼氦鏄撶被鍨嬫�ц兘
		B8 B7 B6 B5 B4 B3 B2 B1 
		1  X  X  X  X  X  X	 X 瀛樻浜ゆ槗
		X  0  X  X  X  X  X	 X RFU
		X  X  0  X  X  X  X	 X RFU
		X  X  X  0  X  X  X	 X RFU
		X  X  X  X  0  X  X	 X RFU
		X  X  X  X  X  0  X	 X RFU
		X  X  X  X  X  X  0	 X RFU
		X  X  X  X  X  X  X	 0 RFU
	TermInfo.TermAddCapab[2]:瀛楄妭3锛岀粓绔暟鎹緭鍏ユ�ц兘
		B8 B7 B6 B5 B4 B3 B2 B1 
		1  X  X  X  X  X  X	 X 鏁板瓧閿�
		X  1  X  X  X  X  X	 X 瀛楁瘝鍜岀壒娈婂瓧绗﹂敭
		X  X  1  X  X  X  X	 X 鍛戒护閿�
		X  X  X  1  X  X  X	 X 鍔熻兘閿�
		X  X  X  X  0  X  X	 X RFU
		X  X  X  X  X  0  X	 X RFU
		X  X  X  X  X  X  0	 X RFU
		X  X  X  X  X  X  X	 0 RFU
	TermInfo.TermAddCapab[1]:瀛楄妭4锛岀粓绔暟鎹緭鍑烘�ц兘
		B8 B7 B6 B5 B4 B3 B2 B1 
		1  X  X  X  X  X  X	 X 鎵撳嵃锛岀粰鏈嶅姟鍛�
		X  1  X  X  X  X  X	 X 鎵撳嵃锛岀粰鎸佸崱浜�
		X  X  1  X  X  X  X	 X 鏄剧ず锛岀粰鏈嶅姟鍛�
		X  X  X  1  X  X  X	 X 鏄剧ず锛岀粰鎸佸崱浜�
		X  X  X  X  0  X  X	 X RFU
		X  X  X  X  X  0  X	 X RFU
		X  X  X  X  X  X  1	 X 缂栫爜琛�10
		X  X  X  X  X  X  X	 1 缂栫爜琛�9
	TermInfo.TermAddCapab[0]:瀛楄妭5锛岀粓绔暟鎹緭鍑烘�ц兘
		B8 B7 B6 B5 B4 B3 B2 B1 
		1  X  X  X  X  X  X	 X 缂栫爜琛�8
		X  1  X  X  X  X  X	 X 缂栫爜琛�7
		X  X  1  X  X  X  X	 X 缂栫爜琛�6
		X  X  X  1  X  X  X	 X 缂栫爜琛�5
		X  X  X  X  1  X  X	 X 缂栫爜琛�4
		X  X  X  X  X  1  X	 X 缂栫爜琛�3
		X  X  X  X  X  X  1	 X 缂栫爜琛�2
		X  X  X  X  X  X  X	 1 缂栫爜琛�1(涓枃缂栫爜)
		
TermInfo.TermType //缁堢绫诲瀷 绯荤粺鍙傛暟涓�22
	鐜锛�					鎿嶄綔鎺у埗鏂�
					閲戣瀺鏈烘瀯	鍟嗘埛	鎸佸崱浜�
鏈夋湇鍔″憳鐨勶細
		浠呬粎鑱旀満		  11         21       --
	鏈夎仈鏈鸿兘鍔涚殑鑴辨満	  12		 22		  --
		浠呬粎鑴辨満		  13         23       --

	鑷姪鐨勶細
		浠呬粎鑱旀満		  14         24       34
	鏈夎仈鏈鸿兘鍔涚殑鑴辨満	  15		 25		  35
		浠呬粎鑴辨満		  16         26       36
澶囨敞锛氱粓绔被鍨嬩负'14','15','16'涓斿叿鏈夌幇閲戞敮鍑鸿兘鍔�(闄勫姞缁堢鎬ц兘鐨勫瓧鑺�1锛屸�滅幇閲戔�濅綅=鈥�1鈥�)
	鐨勭粓绔璁や负鏄疉TM锛屽叾浠栫被鍨嬬殑缁堢閮戒笉琚浣淎TM]
	
PDOL:tag 9F38
		鎸囧畾鍦ㄥ鐞嗛�夐」鍛戒护涓粓绔�佸叆鍗＄墖鐨勬暟鎹�,鍖呮嫭缁堢鏁版嵁瀵硅薄(鏍囩鍜岄暱搴�)
	
Readrecord鏁版嵁鐢ㄤ簬鑴辨満鏁版嵁璁よ瘉:
	1.瀵逛簬SFI浠�1鍒�10鐨勬枃浠�,璁板綍鐨凾AG(70)鍜岃褰曢暱搴︿笉鐢ㄤ簬鑴辨満鏁版嵁璁よ瘉澶勭悊,鍏朵粬鍝嶅簲鏁版嵁鍩�
	涓殑鎵�鏈夋暟鎹�(SW1,SW2闄ゅ)閮藉弬涓庤劚鏈烘暟鎹璇�
	2.瀵逛簬SFI浠�11鍒�30鐨勬枃浠�,璁板綍鐨凾AG(70)鍜岃褰曢暱搴︾敤浜庤劚鏈烘暟鎹璇佸鐞�,鍥犺�屽搷搴旀暟鎹煙
	涓殑鎵�鏈夋暟鎹�(SW1,SW2闄ゅ)閮藉弬涓庤劚鏈烘暟鎹璇�
	3.濡傛灉TAG涓嶆槸'70',鍒欒涓鸿劚鏈烘暟鎹璇佸凡缁忔墽琛屽苟澶辫触,缁堢蹇呴』璁剧疆TSI鐨�"鑴辨満鏁版嵁璁よ瘉宸叉墽琛屼綅"
	浠ュ強TVR鐩稿簲鐨�"鑴辨満闈欐�佹暟鎹璇佸け璐ヤ綅","鑴辨満鍔ㄦ�佹暟鎹璇佸け璐ヤ綅"鎴�"CDA澶辫触浣�"
璇诲嚭cardinfo鏁版嵁鍚庢鏌ユ槸鍚﹀寘鍚簺蹇呴』鐨勬暟鎹�:(ICCDataTable_Stored.flagm=1)
	{"AppExpireDate",0,"\x5F\x24",255,3,1,47,1,0},	//搴旂敤澶辨晥鏃ユ湡
	{"AFL",0,"\x94\x00",0,252,0,51,1,0},			//AFL鏂囦欢
	{"PAN",0,"\x5A\x00",0,10,2,357,1,0},			//涓诲笎鍙�
	{"CDOL1",0,"\x8C\x00",0,252,0,390,1,0},			//CDOL1
	{"CDOL2",0,"\x8D\x00",0,252,0,643,1,0},			//CDOL2 20
	

typedef struct {
	BYTE ASI;  //Application Selection Indicator.0-needn't match exactly(partial match up to the length);1-match exactly
	//搴旂敤閫夋嫨鎸囩ず绗�. = 1 鎸囩ず缁堢涓婄殑AID涓庡崱鐗囦笂鐨凙ID鏄惁瀹屽叏鍖归厤,(闀垮害鍜屽唴瀹归兘蹇呴』涓�鏍�)
					  = 0.閮ㄥ垎鍖归厤,鍗＄墖AID鐨勫墠闈㈤儴鍒嗕笌AID鐩稿悓,闀垮害鍙互鏇撮暱
	BYTE AIDLen;	//搴旂敤鏍囪瘑闀垮害
	BYTE AID[16];//5-16	//搴旂敤鏍囪瘑鐨勫唴瀹�. AID = RID (搴旂敤鎻愪緵鍟嗘爣璇�)+PIX(涓撶敤搴旂敤鎵╁睍)
	BYTE bLocalName;//If display app list using local language considerless of info in card.0-use card info;1-use local language.
	//鏄惁鐢ㄧ粓绔殑搴旂敤鍚嶇О
		= 1鐢ㄧ粓绔殑搴旂敤鍚嶇О
		= 0鐢ㄥ崱鐨勫簲鐢ㄥ悕绉�
	BYTE AppLocalNameLen;	//缁堢搴旂敤鍚嶇О鐨勯暱搴�
	BYTE AppLocalName[16];	//缁堢搴旂敤鍚嶇О鐨勫唴瀹�
}TERMAPP;

typedef struct{
	//BYTE* Name;
	//BYTE  Source;//0-ICC;1-Terminal
	BYTE  Tag[3];//Second byte '00' means only first one byte tag.add third byte to make int variable oven aligned.
	BYTE  Len1;  //Len1>Len2: fix len with Len2;Len1<Len2 and Len2!=255: Len1<= len <=Len2; Len2=255: len=Len1+Len2
	BYTE  Len2;
	BYTE  bAmt;//0- non numeric;1-numeric;2-compact numric
	unsigned int address;//var address 
	BYTE  flagM;//'1'--bit0: mandatory;bit1: SDA mandatory; bit2: DDA mandatory;
	BYTE  bExist;//0-not presented,1-have been existed.	
}DATAELEMENT;	//鏍囩鏁版嵁鏂囦欢


SDA:闈欐�佹暟鎹璇佺敤鍒扮殑鏁版嵁瀵硅薄
	:
	鏍囩		闀垮害		鍊�							鏍煎紡
	 -			  5 		娉ㄥ唽鐨勫簲鐢ㄦ彁渚涘晢鏍囪瘑      	b
	 '8F'		  1			璁よ瘉涓績鍏挜绱㈠紩			b
	 鈥�90鈥�		  Nca		鍙戝崱琛屽叕閽ヨ瘉涔�				b
	 '92'		  Ni-Nca+36 鍙戝崱琛屽叕閽ョ殑浣欓」(濡傛灉鏈�)	b
	 '9F32'		  1鎴�3		鍙戝崱琛屽叕閽ユ寚鏁�				b
	 '93'		  Ni		绛惧悕鐨勯潤鎬佸簲鐢ㄦ暟鎹�			b
	 -			  鍙橀暱		鎸囨槑鐨勯潤鎬佹暟鎹�				b
璁よ瘉鏃跺繀椤诲寘鍚繖浜汿AG鏁版嵁.鍚﹀垯璁や负鑴辨満璁よ瘉杩涜浜嗕笖澶辫触.
	闈欐�佹暟鎹璇佹楠�:
		1.鍒ゆ柇璁よ瘉闇�瑕佺殑鏁版嵁鏄惁閮藉瓨鍦�,鍗充互涓奣AG閮絜xist
		2.鐢辩粓绔仮澶嶈璇佷腑蹇冨叕閽�.
		杩囩▼:鏍规嵁RID鍜屽叕閽ョ储寮曚粠缁堢鐨勫叕閽ラ噷鍙栧叾涓竴涓�,濡傛灉娌″尮閰嶇殑璁や负
		鑴辨満璁よ瘉杩涜浜嗕笖澶辫触.
		3.鐢辩粓绔仮澶嶅彂鍗¤鍏挜.
		杩囩▼:a.妫�鏌ュ彂鍗¤鍏挜璇佷功鍜岃璇佷腑蹇冨叕閽ユā闀垮害鏄惁鐩稿悓.
			 b.鐢ㄨ璇佷腑蹇冨叕閽ュ鍙戝崱璇佷功鎭㈠,鍙栧嚭璇佷功閲岀殑鏁版嵁
			 c.妫�鏌ユ仮澶嶅嚭鏉ョ殑鏁版嵁鏄惁姝ｇ‘,鎭㈠鐨勬暟鎹熬,鏁版嵁澶�,璇佷功鏍煎紡,鍙戝崱
			   琛屾爣璇�,璇佷功鏈夋晥鏈�,鍜屽彂鍗¤绠楁硶鏍囪瘑
			 d.璁＄畻闈欐�佽璇佹暟鎹殑鍝堝笇缁撴灉,骞朵笌鎭㈠鐨勫搱甯岀粨鏋滄瘮杈冩槸鍚︿竴鑷�.
			 e.灏嗘仮澶嶆暟鎹腑鐨勫彂鍗¤鍏挜妯￠儴鍒嗕笌浣欓儴鍒�(濡傛灉鏈�)缁勫悎鎴愬彂鍗¤鍏挜
		4.绛惧悕闈欐�佸簲鐢ㄦ暟鎹殑璁よ瘉
		缁堢鐢ㄥ彂鍗¤鍏挜瀵圭鍚嶇殑闈欐�佸簲鐢ㄦ暟鎹仮澶嶏紝骞惰繘琛屽搱甯屽�兼瘮杈�,楠岃瘉绛惧悕鏄惁姝ｇ‘
		杩囩▼:a.缁堢妫�鏌ョ鍚嶉潤鎬佸簲鐢ㄦ暟鎹笌鍙戝崱琛屽叕閽ユā闀垮害鏄惁鐩稿悓
			 b.缁堢鍒╃敤鍙戝崱琛屽叕閽ュ绛惧悕鐨勯潤鎬佸簲鐢ㄦ暟鎹繘琛屾仮澶�
			 c.妫�鏌ユ仮澶嶆暟鎹殑鍚勯」鏄惁姝ｇ‘锛氭仮澶嶇殑鏁版嵁灏撅紝澶达紝鏁版嵁鏍煎紡
			 d.缁堢渚濇杩炴帴浠庣鍚嶉潤鎬佸簲鐢ㄦ暟鎹仮澶嶅嚭鐨勬暟鎹�佺敱AFL鎸囧畾鐨勭敤浜庤劚鏈烘暟鎹璇佺殑
			   璁板綍鏁版嵁銆佷互鍙婄敱闈欐�佹暟鎹璇佹爣绛惧垪琛ㄨ〃绀虹殑鏁版嵁锛屽苟璁＄畻鍏跺搱甯岀粨鏋�.
			 e.灏嗚绠楃殑鍝堝笇缁撴灉涓庝粠绛惧悕闈欐�佸簲鐢ㄦ暟鎹仮澶嶅嚭鐨勫搱甯岀粨鏋滅浉姣旇緝锛屼竴鑷村垯SDA鎴愬姛
鍏蜂綋鏁版嵁鏍煎紡瑙両C鍗″畨鍏ㄨ鑼�.
			 
			 
//浠庡彂鍗¤鍏挜璇佷功鎭㈠鏁版嵁鐨勬牸寮�
typedef struct{
	BYTE DataHead;		//'6A'鎭㈠鏁版嵁澶�
	BYTE CertFormat;	//'02'璇佷功鏍煎紡
	BYTE IssuID[4];		//涓诲笎鍙锋渶宸﹂潰鐨�3-8涓暟(鍙宠ˉF)鍙戝崱琛屾爣璇�
	BYTE ExpireDate[2];	//璇佷功澶辨晥鏃ユ湡MMYY
	BYTE CertSerial[3];	//璇佷功搴忓垪鍙�
	BYTE HashInd;		//鍝堝笇绠楁硶鏍囪瘑
	BYTE IPKAlgoInd;	//鍙戝崱琛屽叕閽ョ畻娉曟爣璇�
	BYTE IPKLen;		//鍙戝崱琛屽叕閽ョ殑瀛楄妭闀垮害
	BYTE IPKExpLen;		//鍙戝崱琛屽叕閽ユ寚鏁扮殑瀛楄妭闀垮害
	BYTE IPKLeft[212];	//鍙戝崱琛屽叕閽ユ垨鍏挜鏈�宸﹁竟鐨勫瓧鑺侼CA-36涓嶅鍙宠ˉBB
	BYTE HashResult[20];//鍝堝笇缁撴灉
	BYTE DataTrail;		//'BC'鎭㈠鏁版嵁缁撳熬
}IPK_RECOVER;

//浠嶪C鍗″叕閽ヨ瘉涔︽仮澶嶆暟鎹殑鏍煎紡
typedef struct{
	u8 DataHead;//'6A'		//鎭㈠鏁版嵁澶�
	u8 CertFormat;//'04'	//璇佷功鏍煎紡
	u8 AppPAN[10];			//涓诲笎鍙�(鍦ㄥ彸杈硅ˉ涓�'F')
	u8 ExpireDate[2];		//MMYY璇佷功澶辨晥鏃ユ湡
	u8 CertSerial[3];		//璇佷功搴忓垪鍙�
	u8 HashInd;				//鍝堝笇绠楁硶鏍囪瘑
	u8 ICCPKAlgoInd;		//IC鍗″叕閽ョ畻娉曟爣璇�
	u8 ICCPKLen;			//IC鍗″叕閽ラ暱搴�
	u8 ICCPKExpLen;			//IC鍗″叕閽ユ寚鏁伴暱搴�
	u8 ICCPKLeft[206];//NI-42	//IC鍗″叕閽ユ垨IC鍗″叕閽ョ殑鏈�宸﹁竟瀛楄妭
	u8 HashResult[20];		//鍝堝笇缁撴灉
	u8 DataTrail;			//'BC'鎭㈠鏁版嵁缁撳熬
}ICCPK_RECOVER;

//浠庣鍚嶇殑闈欐�佸簲鐢ㄦ暟鎹仮澶嶆暟鎹殑鏍煎紡
typedef struct {	
	u8 DataHead;//'6A'			//鏍煎紡澶�'6A'
	u8 DataFormat;//'03'		//绛惧悕鏁版嵁鏍煎紡'03'
	u8 HashInd;					//鍝堝笇绠楁硶鏍囪瘯'01'
	u8 DataAuthCode[2];			//鏁版嵁楠岃瘉浠ｇ爜"鏈�鍚庝繚瀛樺湪9F45TAG涓�"
	u8 PadPattern[222];//NI-26	//濉厖瀛楄妭
	u8 HashResult[20];			//缁撴灉
	u8 DataTrail;//'BC'			//'BC'鎭㈠鏁版嵁缁撳熬
}SIGN_STAT_APPDATA_RECOVER;	

//浠庣鍚嶅姩鎬佸簲鐢ㄦ暟鎹仮澶嶇殑鏁版嵁鏍煎紡
typedef struct {
	u8 DataHead;//'6A'
	u8 DataFormat;//'05'
	u8 HashInd;//'01'
	u8 ICCDynDataLen;
	u8 ICCDynData[223];//LDD	<NIC-25
	u8 PadPattern[223];//NIC-LDD-25,padded with 'BB'
	u8 HashResult[20];		
	u8 DataTrail;//'BC'
}SIGN_DYN_APPDATA_RECOVER;
*/
/*****************************************************************
EMV 搴曞眰ICCard椹卞姩鍙婃帴鍙ｅ嚱鏁�   2008/03/31  瀹嬪瓭浜垱寤�
*****************************************************************/
#ifndef _EMV_H_
#define _EMV_H_

#include <stdint.h>


#include "dllemvmaths.h" 

//#define PAYWAVECVN17SUP    (1<<2)  

#define ARM_ADS_GCC
#undef ARM_ADS_GCC

#define EMV_LEVEL2TEST    		//EMVLEVEL2閫佹绋嬪簭缂栬瘧寮�鍏�
#undef  EMV_LEVEL2TEST			

#ifndef EMVB_DEBUG
#define EMVB_DEBUG 
#endif

//extern void emvb_printf(char *fmt,...);
//extern int memcmp(const void *buffer1,const void *buffer2,int count);
//extern void emv_emvb_printf(char *fmt,...);

#ifdef ARM_ADS_GCC
//#define printfemv emv_emvb_printf
#define ATTRIBUTE 
#else
#define ATTRIBUTE __attribute__((packed))
#define printfemv //emvb_printf
#endif


#ifndef TEMPTEST
//#define TEMPTEST
#endif

//#define HX_DEBUG
#ifndef SXL_DEBUG
//#define SXL_DEBUG
#endif
//#define TESTREADCARDTIME
#ifndef SXL_DEBUG1
//#define SXL_DEBUG1
#endif

#define EMV_ENGLISH								 49
#define EMV_CHINESE								 50

#define MAG_LAST_FAIL_IC        0x92
#define MAG_NO_IC				    0x90
#define MAG_LAST_SUCCESS_IC		0x91

#define CARDTYPE_EMV 0x00
#define CARD_QPBOC   0x01
#define CARD_UPCARD  0x03
#define CARD_PAYPASS 0x08
#define CARD_PAYWAVE 0x09


#define IC_SUCCESS				0x05
#define IC_FAIL					0x95
#define qPBOC_USED				0x07		//20110518 modify based on qPBOC spceification
#define MSD_USED				0x91		//20110514 FOR MSD
#define CLPBOC_USED             0x98


#define CONTACTLESSFAIL         0xF0        //闈炴帴鍗′氦鏄撳け璐�


#define LOGTYPE_CAPDU  0x00
#define LOGTYPE_RAPDU  0x01
#define LOGTYPE_DEK    0x02
#define LOGTYPE_DET    0x03



#define LOGTYPE_STATUS_OK   0x00
#define LOGTYPE_STATUS_FAIL 0x01




#define MAXPAYPASSCCCTIMES 5

/*******************************************************
        2008-03-31 
淇敼淇℃伅:

瀹氫箟杩斿洖鐨勬暟鎹被鍨�        2008-03-31
淇敼淇℃伅:emv澶勭悊娴佺▼

********************************************************/
#define EMVTRANSINIT               9 //浜ゆ槗鍙傛暟鍒濆鍖�
#define EMVAPPSELECT              10//寤虹珛搴旂敤鍒楄〃
#define EMVCHOOSEAPP               11//搴旂敤閫夋嫨
#define EMVINITAPP                12//搴旂敤鍒濆鍖�
#define EMVREADRECORD             13//璇诲簲鐢ㄨ褰�
#define EMVDATAAURH                 14//闈欐�佹暟鎹璇�
#define EMVPROCESSRESTRICT         15//澶勭悊闄愬埗
#define EMVCARDHOLDERVERF          16//鎸佸崱浜鸿璇�
#define EMVTERMRISKMANAGE          17//缁堢椋庨櫓绠＄悊
#define EMVTERMIANALYS             18//缁堢琛屼负鍒嗘瀽
#define EMVTRANSPROCESS            19//浜ゆ槗澶勭悊
#define EMVTRANSANALY               20
#define EMVDEALBAGDATA              21
#define EMVSENDBAG                  22
#define EMVFINALSELECT               23  //搴旂敤鏈�缁堥�夋嫨
#define EMVUSERSELECTAPP             24
#define EMVRESELECTAPP              25  //閲嶆柊閫夋嫨搴旂敤
#define EMVCOMPLETETRANS            26  //EMV瀹屾垚浜ゆ槗
#define EMVPRECOMPLETETRANS         27
#define EMV_TRANSCOMPLETEPROMAT    29   //浜ゆ槗瀹屾垚鎻愮ず
/*******************************************************
瀹氫箟杩斿洖鐨勬暟鎹被鍨�        2009-07-03
淇敼淇℃伅:qPBOC澶勭悊娴佺▼

********************************************************/
#define qPBOCPRETRANS               30 //棰勪氦鏄撳鐞�
#define qPBOCDETECTCARD             31 //妫�娴嬪崱鐗�
#define qPBOCSELECTAPP              32 //閫夋嫨搴旂敤
#define ECREADECDATA                33 //璇诲彇EC搴旂敤鏁版嵁
#define ECGETECBALANCE              34 //浜ゆ槗缁撴潫鍚庡緱鍒扮數瀛愮幇閲戜綑棰�
#define INPUTECPIN                  35 //鐢靛瓙鐜伴噾瓒呴槇鍊煎悗闇�瑕佽緭鍏IN

#define EMVREQUESTAMOUNT				50
#define EMVREQUESTOFFPIN				51
#define EMVREQUESTPIN					52
#define EMVREQUESTSENDBAG				53
#define EMVREQUESTECPIN					54

#define PAYPASS_CHECKAVN                70
#define PAYPASS_COMPUTECRYPTOCHECKSUM   71
#define PAYPASS_ODAMETHODSELECT         72

#define PAYWAVE_DISPLAY                 73
#define PAYWAVEDETECTCARD               74
#define PAYPASSONLINEPIN                75
#define PAYWAVE_MULTICARD               76
#define PAYWAVE_MULTICARD_DETECTEDCARD  77

#define PAYPASS_PREGETACBALANCEREAD 78
#define PAYPASS_MSCHECKCVM          79
#define PAYPASS_DEALDATAAUTHAFTERGAC 80
#define PAYPASS_GETACBALANCEREAD     81


/*******************************************************
瀹氫箟杩斿洖鐨勬暟鎹被鍨�        2008-03-31
淇敼淇℃伅:

********************************************************/
#define APPSEL_PSEFOUND		2
#define APPSEL_PSENOTFOUND  3
#define RESELECT			4
#define OK_AddOfflineAdvice 5

#define ERR_EMV_NoBatchData     21
#define ERR_EMV_ScriptLen		  22
#define ERR_EMV_ScriptReturn    23
#define ERR_EMV_ScriptFormat    24
#define ERR_EMV_TermDataMissing 25
#define ERR_EMV_ComOpen         26
#define ERR_EMV_ComSend         27
#define ERR_EMV_ComRecv         28
#define ERR_EMV_MsgData         29
#define ERR_EMV_IssuerAuthen    30
#define ERR_EMV_FileSys         31
#define ERR_EMV_SendAuthRQ      32
#define ERR_EMV_SendReconci     33

#define ERR_EMV_IccDataFormat   34
#define ERR_EMV_IccCommand      35
#define ERR_EMV_IccReturn		  36
#define ERR_EMV_NoAppSel        37
#define ERR_EMV_IccDataMissing  38
#define ERR_EMV_IccDataRedund   39
#define ERR_EMV_AppReselect     40
#define ERR_EMV_GetChallenge    41
#define ERR_EMV_CVRFail         42
#define ERR_EMV_CVRNoSupport    43
#define ERR_EMV_InterAuth       44
#define ERR_EMV_InputCancel     45
#define ERR_EMV_PSENoMatchApp   46
#define ERR_EMV_ListNoMatchApp  47
#define ERR_EMV_NotAccept		   48
#define ERR_EMV_EmvDataFormat   49
#define ERR_EMV_CancelTrans     50
#define ERR_EMV_CardBlock       51 //added on Oct 10,2003
#define ERR_EMV_CDADifferCID    52 //added on May 25,2004


#define ERR_CANCEL				53
#define ERR_APP_TIMEOUT  	   	54
#define FAIL			55
#define ERR_NEEDMAGCARD 56	//GAC鏃跺�欒繑鍥炵殑鏄�6985
#define ERR_BLOCKORFORMATERR 57
#define EMV_PARSESUC          58     //sxl 瑙ｆ瀽鎴愬姛
#define EMV_APPBLOCK          59
#define EMV_EXTRACTMATCH      60
#define EMV_PARTICALMATCH     61
#define EMV_NOTMATCH           62
#define EMV_USERSELECT         63    //鎻愪緵搴旂敤鍒楄〃缁欑敤鎴烽�夋嫨
#define ERR_EMVINITAPP_NOTACCEPED 64
#define EMV_REQUESTPLAINTEXTPIN   65 //EMV璇锋眰鏄庢枃PIN
#define EMV_REQUESTONLINEENCPIN   66 //璇锋眰鑱旀満鍔犲瘑PIN
#define EMV_REQUESTOFFENCPIN      67 //璇锋眰鑴辨満鍔犲瘑PIN
#define EMV_OFFLINEPINSUC         68 //鑴辨満瀵嗙爜姝ｇ‘
#define EMV_OFFLINEPINERR         69 //鑴辨満瀵嗙爜閿欒
#define EMV_TRY_AGAIN_PIN        70 //璇烽噸璇曠殑
#define EMV_LAST_PIN_TRY          71 //鏈�鍚庝竴娆�
#define EMV_APPSELECTTRYAGAIN     72 //閲嶉�夊簲鐢�
#define EMV_APPSELECTTRYAGAINSUC  73 
#define EMV_SHOWRANDNUM            74
#define EMV_ONLINEWAIT             75
#define EMV_NEEDREFER              76  //闇�瑕丷EFER
#define EMV_NEEDREVERSAL           77 //闇�瑕佸彂閫佸啿姝�
#define EMV_APPROVED                78 //浜ゆ槗鎵瑰噯
#define EMV_DECLINED                79//浜ゆ槗鎷掔粷
#define EMV_TRANS_COMPLETED        80//浜ゆ槗瀹屾垚
#define EMV_REQUESTAMOUNT          81//璇锋眰杈撳叆閲戦
#define EMV_VERIFYIDCARD          82 //PBOC璇佷欢璁よ瘉
#define EMV_DISPEMVRECORD         83 //鏄剧ず浜ゆ槗璁板綍
#define EMV_RETURNDISPLAYLOG      84//鏄剧ず瀹屼氦鏄撴棩蹇楄繑鍥�
#define EMV_NORECORD               85//娌℃湁浜ゆ槗鏃ュ織
#define EMV_READLOGEND             86//璇讳氦鏄撴棩蹇楃粨鏉�
#define ERR_EMV_CDADifferCIDTC    87//CDA TC
#define ERR_EMV_CDAFORMAT          88//CDA TC鏃舵牸寮忎笉瀵�
#define ERR_EMV_CVRFailALWAYS      89//CVR FAIL
#define EMV_SELECTNEXTDDF          90 //瑕佸幓璇讳笅涓�涓狣DF
#define EMVENC_LAST_PIN_TRY          91 //OFFLINE ENC 
#define EMVENC_TRY_AGAIN_PIN         92//OFFLLINE ENC
#define ERR_EMV_InputERROR           93

#define EMV_NEEDSENDCOMMAND      97
#define EMVERRDEAL                98//浜ゆ槗閿欒澶勭悊
#define EMVTERMINATEDEAL         99//浜ゆ槗澶辫触澶勭悊
#define TRANS_ONLINE_APPROVE     100
#define TRANS_ONLINE_DECLINE     101
#define EMVTRANS_COMPLETE        102
#define TRANS_OFFLINE_APPROVE    103
#define TRANS_OFFLINE_DECLINE    104
#define TRANS_TERMINATE_TRANS_ERR 105
#define TRANS_TERMINATE_TRANS_NOTACCEPT 106
#define TRANS_EMV_TRANS_COMPLETED  107
#define EMV_ICCGETPAN              108
#define EMV_COUNTFLOORLIMIT        109
#define qPBOC_READRECORD         110//qPBOC璇诲崱璁板綍鏁版嵁
#define qPBOC_USEMSD             111 //浣跨敤MSD澶勭悊
#define qPBOC_USEPBOC            112 //浣跨敤PBOC澶勭悊
#define qPBOC_APPEFFECT          113 //搴旂敤灏氭湭鐢熸晥
#define qPBOC_APPEXPIRED         114 //搴旂敤澶辨晥
#define EC_NOTSUPPORT            115 //璇ュ崱鏄函鐢靛瓙鐜伴噾鍗★紝涓嶆敮鎸佽鍔熻兘
#define EC_QUANCUNERR            116 //鍦堝瓨閿欒 // add 091127
#define EMV_NOECTRADE            117
#define qPBOC_RESTARTRANDE       118

#define PAYWAVE_DISPMESSAGE      120
#define PAYWAVE_PAYWAVEIUP       121
#define PAYPASS_CCCWAIT          122
#define PAYPASS_PREDEALFAILED    123
#define PAYPASS_ENDAPPLICATION   124
#define PAYPASS_ERRICCRETURN     125
#define PAYPASS_CCCERR           126
#define PAYPASS_CCCWAITERR       127  //杩欓噷鏄粠reset 寮�濮嬪悧
#define PAYWAVE_DETECTEDOTHERMODE 128
#define PAYPASS_TRYANOTHERMODE    129

#define qPBOC_READAIDPARAMETERS   169
#define qPBOC_OTHERAPCARD         170
#define qPBOC_RESETCOMMAND        171
#define qPBOC_RESETFAIL           172
#define qPBOC_DETECTCARDOVERTIME  173
#define qPBOC_MULTICARD           174
#define qPBOC_OTHERERR            175
#define qPBOC_COMPLETE            176
#define qPBOC_RECEIVEDOVERTIME    177
#define qPBOC_READCARDERR         178
#define qPBOC_RECEIVEBAGERR       179
#define PAYPASS_READAFTERBALANCEOK 	  180  //jiguang 
#define PAYPASS_RESELECTAPP	  181  //jiguang add
#define ERR_EMV_IccCommandERR      182
#define PAYPASS_DEALWAIT           183
#define PAYPASS_PARSEERR 184
#define PAYPASS_CARDDATAMISSING 185
#define PAYPASS_CARDDATAERR     186
#define PAYPASS_SW1SW2ERR       187
#define PAYPASS_PHONECCCPCIIONLYE 188
#define PAYPASS_DECLINED           189
#define ERR_LASTRECORD             190
#define QPBOC_GETBALANCERETURN       191
#define QPBOC_BLACKLISTCARD          192
#define PAYWAVE_INTERCARD            193
#define PAYEAVE_DOUBLEDIP            194
#define PAYPASSIDSWRITEERR           195
#define PAYPASSIDSREADERROR          196
#define PAYWAVETRADEERR              197
#define APPSELECT_APPBLOCK_EXTRACTMATCH          198
#define APPSELECT_APPBLOCK_PARTICALMATCH         199

/*******************************************************
鏍囩琛�       2008-03-31
淇敼淇℃伅:

********************************************************/
//card variable
#define TermDataBase   100




#define MV_AppCrypt				0
#define	MV_AppCurcyCode			1
#define	MV_AppCurcyExp			2
#define	MV_AppDiscretData		3
#define	MV_AppEffectDate		4
#define	MV_AppExpireDate		5
#define	MV_AFL					6
#define	MV_ICC_AID				7
#define	MV_AIP					8
#define	MV_AppLabel				9
#define	MV_AppPreferName		10
#define	MV_PAN					11
#define	MV_PANSeqNum			12
#define	MV_AppPriority			13
#define	MV_AppReferCurcy		14
#define	MV_AppReferCurcyExp		15
#define	MV_ATC					16
#define	MV_AUC					17
#define	MV_ICC_AppVer			18
#define	MV_CDOL1				19
#define	MV_CDOL2				20
#define	MV_CardholderName		21
#define	MV_CardholderNameExt	22
#define	MV_CVMList				23
#define	MV_ICCAPKI				24
#define	MV_CryptInfoData		25
#define	MV_DataAuthenCode		26
#define	MV_DFName				27
#define	MV_DDFName				28
#define	MV_DDOL					29
#define	MV_ICCDynNum			30
#define	MV_ICCPIN_EPKCert		31
#define	MV_ICCPIN_EPKExp		32
#define	MV_ICCPIN_EPKRem		33
#define	MV_ICCPKCert			34
#define	MV_ICCPKExp				35
#define	MV_ICCPKRem				36
#define	MV_IACDenial			37
#define	MV_IACOnline			38
#define	MV_IACDefault			39
#define	MV_IssuAppData			40
#define	MV_ICTI					41
#define	MV_IssuCountryCode		42
#define	MV_IPKCert				43
#define	MV_IPKExp				44
#define	MV_IPKRem				45
#define	MV_LangPrefer			46
#define	MV_LOATCReg				47
#define	MV_LCOL					48
#define	MV_PINTryCount			49
#define	MV_PDOL					50
#define	MV_ServiceCode			51
#define	MV_SignDynAppData		52
#define	MV_SignStatAppData		53
#define	MV_SDATagList			54
#define	MV_Track1Discret		55
#define	MV_Track2Discret		56
#define	MV_Track2Equivalent		57
#define	MV_TDOL					58
#define	MV_UCOL					59
#define	MV_IssuerURL			60
#define	MV_VLPAvailableFund		61
#define	MV_VLPIssuAuthorCode	62
//lechan 2005-12-26 16:09
#define MV_CardholderIdType 63
#define MV_CardholderIdNo 64
//  add for qPBOC
#define MV_CardTransPredicable  65
#define MV_UNPREDICTUDOL        66
#define MV_OffAmountDisplay     67
#define MV_PAYWAVEFFI           68

#define MV_PAYPASSTRACK2DATA    73
#define MV_PAYPASSPUNATCTRACK2  74
#define MV_PAYPASSPCVC3TRACK2   75
#define MV_PAYPASSNATCTRACK2    76

#define MV_PAYPASSCVC3TRACK1    77
#define MV_PAYPASSNATCTRACK1    78
#define MV_PAYPASSTRACK1DATA    79
#define MV_PAYPASSCVC3TRACK2    80
#define MV_PAYPASSPCVC3TRACK1   81
#define MV_PAYPASSPUNATCTRACK1  82
#define MV_PAYWAVEAPD           83
#define MV_PAYPASSMAGVER        84

#define MV_PAYPASSPREBALANCE		85   //jiguang 20121220
#define MV_PAYPASSDRDOL		86	 //jiguang 20121221
#define MV_PAYPASSPOSCII 	87	 //jiguang 20121221
#define MV_PAYPASSPOSTBALANCE 88  //jiguang 
#define MV_PAYPASSAPPCAPINFO  89

//other variable needed for host-terminal message
//#define MV_MessageType			80
//#define MV_EncPINData			81
//#define MV_IssuAuthenData		82
//#define MV_IssuScript			83
//#define MV_IssuScriptResult		84
//#define MV_CAPK                 85
//#define MV_ExceptFile           86

//terminal variable
#define	MV_AcquireID			100
#define	MV_TermCapab			101
#define	MV_TermAddCapab			102
#define	MV_IFDSerial			103
#define	MV_TermID				104
#define	MV_MerchCateCode		105
#define	MV_MerchID				106
#define	MV_TermCountryCode		107
#define	MV_TRMData				108
#define	MV_TermType				109
#define	MV_TermAppVer			110
#define	MV_TransCurcyCode		111
#define	MV_TransCurcyExp		112
#define	MV_TransReferCurcyCode	113
#define	MV_TransReferCurcyExp	114
#define	MV_TACDenial			115
#define	MV_TACOnline			116
#define	MV_TACDefault			117
#define	MV_TransType			118
#define	MV_TransTypeValue		119
#define	MV_VLPTransLimit		120
#define	MV_VLPTACDenial			121
#define	MV_VLPTACOnline			122
#define	MV_VLPTACDefault		123
#define	MV_Language				124
#define	MV_bTermDDOL			125
#define	MV_bForceAccept			126
#define	MV_bForceOnline			127
#define	MV_bBatchCapture		128
#define	MV_bTermSupportVLP		129
#define	MV_MaxTargetPercent		130
#define	MV_TargetPercent		131
#define	MV_TermDDOL				132
#define	MV_TermTDOL				133
#define	MV_MerchNameLocate		134
#define	MV_TransLogMaxNum		135
#define	MV_Threshold			136
#define	MV_TermFloorLimit		137
#define	MV_AmtTrans				138
#define	MV_AmtNet				139
#define	MV_BatchTransNum		140
#define	MV_TransNum				141
#define	MV_TransIndex			142
#define	MV_TransSeqCount		143
#define	MV_AmtAuthorBin			144
#define	MV_AmtAuthorNum			145
#define	MV_AmtOtherBin			146
#define	MV_AmtOtherNum			147
#define	MV_AmtReferCurrency		148
#define	MV_TERM_AID				149
#define	MV_AuthorCode			150
#define	MV_AuthorRespCode		151
#define	MV_CVMResult			152
#define	MV_POSEntryMode			153
#define	MV_PIN					154
#define	MV_TVR					155
#define	MV_TSI					156
#define	MV_VLPIndicator			157
#define	MV_TransDate			158
#define	MV_TransTime			159
#define	MV_TCHashValue			160
#define	MV_UnpredictNum			161
#define	MV_IssuerAuthenData		162
#define MV_TransCateCode        163


//lechan 2006-1-7 11:45涓婂崍
#define MV_TradeType	164
#define MV_Script71Data 165
#define MV_Script72Data 166
#define MV_ScriptResult 167
#define MV_MerchantName	168
// add for qPBOC
#define MV_TermTransPredicable  169
#define MV_paypassMerchantCustomData 170
#define MV_OffSpendAmount       171
#define MV_FormFactIndicator    172
#define MV_CustomerExclusiveData 173

//jiguang add for Paypass ver3.0.1 20121217
/**************User Interface Request Data********************/
#define UIRD_MessageIdentifier 0
#define UIRD_Status 1
#define UIRD_HoldTime 2
#define UIRD_LanguagePreference 5
#define UIRD_ValueQualifier 13
#define UIRD_Value 14
#define UIRD_CurrencyCode 20
//========Message  Identifier========
#define MI_CARDREADOK 0x17
#define MI_TRYAGAIN 0x21
#define MI_APPROVED 0x03
#define MI_APPROVEDSIGN 0x1A
#define MI_DECLINED 0x07
#define MI_ERROROTHERCARD 0x1C
#define MI_INSERTCARD 0x1D
#define MI_SEEPHONE 0x20
#define MI_AUTHORISINGPLEASEWAIT 0x1B
#define MI_CLEARDISPLAY 0x1E
//===========Status============
#define Status_NOTREADY 0x00
#define Status_IDLE 0x01
#define Status_READYTOREAD 0x02
#define Status_PROCESSING 0x03
#define Status_CARDREADSUCCESSFUL 0x04
#define Status_PROCESSINGERROR 0x05
//============Value Qualifier==========
#define VQ_NONE 0x00
#define VQ_AMOUNT 0x10
#define VQ_BALANCE 0x20

/**************Error Indication********************/
#define EI_L1 0
#define EI_L2 1
#define EI_L3 2
#define EI_SW12 3
#define EI_MsgOnError 5
//===========L1============
#define L1_OK 0x00
#define L1_TIMEOUTERROR 0x01
#define L1_TRANSMISSIONERROR 0x02
#define L1_PROTOCOLERROR 0x03
//==========L2=============
#define L2_OK 0x00
#define L2_CARDDATAMISSING 0x01
#define L2_CAMFAILED 0x02
#define L2_STATUSBYTES 0x03
#define L2_PARSINGERROR 0x04
#define L2_MAXLIMITEXCEEDED 0x05
#define L2_CARDDATAERROR 0x06
#define L2_MAGSTRIPENOTSUPPORTED 0x07
#define L2_NOPPSE 0x08
#define L2_PPSEFAULT 0x09
#define L2_EMPTYCANDIDATELIST 0x0A
#define L2_IDSREADERROR 0x0B
#define L2_IDSWRITEERROR 0x0C
#define L2_IDSDATAERROR 0x0D
#define L2_IDSNOMATCHINGAC 0x0E
#define L2_TERMINALDATAERROR 0x0F
//===========L3============
#define L3_OK 0x00
#define L3_TIMEOUT 0x01
#define L3_STOP 0x02
#define L3_AMOUNTNOTPRESENT 0x03

/**************Outcome Parameter Set********************/
#define OPS_Status 0
#define OPS_Start 1
#define OPS_OnlineResponseData 2
#define OPS_CVM 3
#define OPS_SetBit 4
#define OPS_AlternateInterfacePreference 5
#define OPS_FieldOffRequest 6
#define OPS_RemovalTimeout 7
//============Status=============
#define Status_APPROVED 0x10
#define Status_DECLINED 0x20
#define Status_ONLINEREQUEST 0x30
#define Status_ENDAPPLICATION 0x40
#define Status_SELECTNEXT 0x50
#define Status_TRYANOTHERINTERFACE 0x60
#define Status_TRYAGAIN 0x70
//===============Start===========
#define Start_A 0x00
#define Start_B 0x10
#define Start_C 0x20
#define Start_D 0x30
//==============CVM===========
#define Cvm_NOCVM 0x00
#define Cvm_OBTAINSIGNATURE 0x10
#define Cvm_ONLINEPIN 0x20
#define Cvm_CONFIRMATIONCODEVERIFIED 0x30

/*******************************************************
emvtask      2008-03-31 
淇敼淇℃伅:

********************************************************/
#define EMVNONE 0
#define EMVMAINFACE 1	//涓荤晫闈㈢姸鎬�
#define EMVREADLOG 2	//璁剧疆鑿滃崟閲岃浜ゆ槗鏃ュ織
#define MAGTRADE 3
#define EMVHAVECARDIN 4
#define EMVREADLOGCARDIN 5
#define WAITOUTCARD   6
/*******************************************************
瀹氫箟瀵归敊       2008-03-31
淇敼淇℃伅:

********************************************************/
#define EMV_OK					0
#define EMV_ERR					1
#define EMV_OTHER              2

/*******************************************************
鏀寔鐢ㄦ埛閫夋嫨搴旂敤      2008-03-31
淇敼淇℃伅:

********************************************************/
#define bProvideConfirm  1
/*******************************************************
ASI鍒楄〃鍖归厤       2008-03-31
淇敼淇℃伅:

********************************************************/
#define PARTIAL_MATCH  0
#define EXACT_MATCH    1

/*******************************************************
EMV鍗″骇鍙�      2008-03-31
淇敼淇℃伅:

********************************************************/
/*******************************************************
鍙戠粰EMV鍗＄殑鍛戒护鏍煎紡閿�      2008-03-31
淇敼淇℃伅:

********************************************************/
#define COMMANDERR 0xAA	
#define COMMTIMEOUT 0xBB




/*******************************************************
鍙戠粰EMV鍗＄殑鍛戒护鏍煎紡閿�      2008-03-31
淇敼淇℃伅:

********************************************************/
#define typePDOL	0
#define typeCDOL1	1
#define typeCDOL2	2
#define typeDDOL	3
#define typeTDOL	4
#define typeDRDOL   5
#define typeDSDOL   6

#define GenerateAC1  1
#define GenerateAC2  2
/*******************************************************
浜ゆ槗绫诲瀷      2008-03-31
淇敼淇℃伅:

********************************************************/
typedef enum
{
    TRANS_TYPE_PURCHASE = 0,
    TRANS_TYPE_CASH = 1,
    TRANS_TYPE_ADJUSTMENT = 2,
    TRANS_TYPE_PURCHASE_WITH_CASHBACK = 9,
    TRANS_TYPE_CASH_DISBURSEMENT = 0x17,
    TRANS_TYPE_REFUND = 0x20,
    TRANS_TYPE_BALANCE_INQUIRY = 0x31,
    TRANS_TYPE_IGNORE = 0xFF
}ICC_TRANS_TYPE;



#define CASH        TRANS_TYPE_CASH
#define GOODS       TRANS_TYPE_PURCHASE
//#define SERVICE     2
#define CASHBACK    TRANS_TYPE_PURCHASE_WITH_CASHBACK
#define REFUND      TRANS_TYPE_REFUND
/*******************************************************
CVR RESULT      2008-03-31 
淇敼淇℃伅:

********************************************************/
#define CVR_UNKNOWN		0
#define CVR_FAIL		1
#define CVR_SUCCESS		2


/*******************************************************
搴旂敤绫诲瀷      2008-03-31
淇敼淇℃伅:

********************************************************/
#define EMVTYPE   0
#define PBOCTYPE  1
#define qPBOCTYPE 2
#define MSDTYPE   3

typedef enum
{

    ICC_KERNEL_ID_0_EMV = 0,
    ICC_KERNEL_ID_2_PAYPASS = 2,
    ICC_KERNEL_ID_3_PAYWAVE = 3,
    ICC_KERNEL_ID_4_AMEX = 4,
    ICC_KERNEL_ID_5_JCB =  5,
    ICC_KERNEL_ID_6_DISCOVER =  6,
    ICC_KERNEL_ID_7_UNIONPAY =  7

}ICC_KERNEL_ID;


/*******************************************************
鎸佸崱浜鸿璇佽繘琛屽埌鐨勬楠�      2008-03-31
淇敼淇℃伅:

********************************************************/
#define CARDHOLDERVER_INIT 0
#define CARDHOLDERVER_ANALY 1
#define CARDHOLDERVER_PERFORM  2


#define VERIFYSTEP_INIT  0
#define VERIFYSTEP_PLAINTEXTPIN 1
#define VERIFYSTEP_ENCONLINEPIN 2
#define VERIFYSTEP_ENCOFFLINEPIN 3
#define VERIFYSTEP_VERIFYIDCARD  4
#define VERIFYSTEP_PINERR         5
#define VERIFYSTEP_GETCHANLLENGE 6


//#define PINPAD_VALID 1


//........Analyse.c
#define OFFLINE 10
#define ONLINE  11
#define DENIAL  13

//transaction result
#define OFFLINE_APPROVE		10
#define OFFLINE_DECLINE		11
#define ONLINE_APPROVE		12
#define ONLINE_DECLINE		13
#define ONLINE_WAIT			14	//2006-8-12 17:14
#define TERMINATE_TRANS_ERR   15
#define TERMINATE_TRANS_NOTACCEPT 16 //闇�瑕佹樉绀篘OT ACCEPT,骞剁粓姝氦鏄�
#define FINAL_ONLINEAPPROVE        17
#define FINAL_ONLINEDECLINE        18
#define FINAL_ONLINEERRCODE        19
#define FINAL_ONLINEERRBACK        20
#define FINAL_PAYPASSUSEOTHERMODE  21
#define ONLINE_RESULTUNKNOW        22

#define CryptType_TC      10
#define CryptType_ARQC    11
#define CryptType_AAR     12
#define CryptType_AAC     13


#define EMVRMAINACC  1
#define EMVRTRADEAMOUNT 12
#define INDEXLEN  128

#define ICC_REFER         0
#define ISSUER_REFER	  1


#define TRANSLOGMAXNUM 38

#define NORMALSALE 0
#define CASHBACKSALE 1


/**********************************
鍙戦�佸懡浠ょ殑缁撴瀯
***********************************/
/*
#define EMVFIRST 0
#define WAITCARDDATA 1
#define WAITCARDDATA1 2
#define WAITCARDDATA2 3
#define WAITCARDDATA3 4
#define WAITCARDDATA4 5
#define WAITCARDDATA5 6
#define WAITCARDDATA6 7
#define WAITCARDDATA7 8
#define WAITCARDDATA8 9
#define WAITCARDDATA9 10
#define WAITCARDDATA10 11
#define WAITCARDDATA11 12
#define WAITCARDDATA12 13
#define WAITCARDDATA13 14
#define WAITCARDDATA14 15
#define WAITCARDDATA15 16
#define WAITCARDDATA16 17
#define WAITCARDDATA17 18
#define WAITCARDDATA18 19
*/




#define MAXSCRIPTLEN 128



//display-string macro definition
#define VERSION_INFO                            0
//standard message:0x01-0x13.
#define AMOUNT									  1
#define AMOUNT_OK								  2
#define APPROVED                                 3
#define CALL_YOUR_BANK                           4
#define CANCEL_OR_ENTER                           5
#define CARD_READ_ERROR                           6
#define DECLINED								  7
#define ENTER_AMOUNT                              8
#define ENTER_PIN                                 9
#define INCORRECT_PIN                            10
#define INSERT_CARD                              11
#define NOT_ACCEPTED							 12
#define PIN_OK									 13
#define PLEASE_WAIT								 14
#define PROCESSING_ERROR                         15
#define REMOVE_CARD                              16
#define USE_CHIP_READ                            17
#define USE_MAG_STRIPE                           18

//main and setup menu title
#define UPDATE_PARA							     20
#define BATCH_UP								 21
#define PRINT_RECEIPT                            22

#define SET_SYSTIME								 30
#define SET_TIDMID								 31
#define SELECT_LANGUAGE                          32
#define SET_TAC									 33
#define SET_TRMPARA								 34
#define SET_TRANSTYPE                            35
#define SET_VLPPARA								 36



#define TRANS_REFUSED                            40
#define BYPASS_REFERRAL                          41
#define ACCEPT_TRANS							 42
#define DECLINE_TRANS							 43
#define FORCE_ONLINE							 44
#define TITLE_APP_SELECT                         45
#define MAGCARD_READ_ERROR                       46
#define EMV_LEVEL2_TEST                          47
#define SAND_TECH_LTD							 48
#define EMV_ENGLISH								 49
#define EMV_CHINESE								 50
#define SETUP_DATE                               51
#define YYMMDD									 52
#define OLD_FL									 53
#define NEW_FL									 54
#define SETUP_TIME                               55
#define HHMM									 56
#define TERMINAL_ID								 57
#define OLD_ID									 58
#define NEW_ID                                   59
#define MERCHANT_ID								 60
#define TAC_DENIAL								 61
#define TAC_ONLINE								 62
#define TAC_DEFAULT								 63
#define OLD_TAC									 64
#define NEW_TAC									 65
#define FLOOR_LIMIT								 66
#define THRESHOLD								 67
#define TP										 68
#define MTP										 69
#define NEED_PIN								 70
#define ENTER_FOR_YES							 71
#define CANCEL_FOR_NO							 72
#define NO_APP_TRANS							 73
#define POSPRN_NO_PAPER							 74
#define PRN_POSPRINTING							 75
#define PUT_ON_BASE								 76
#define PRN_ERROR								 77
#define NO_BATCH_DATA                            78
#define ONLINE_ERROR							 79
#define READ_TRACK1_OK							 80
#define READ_TRACK2_OK							 81
#define READ_TRACK3_OK							 82
#define BATCH_UP_OK								 83
#define TRANS_COMPLETED                          84
#define TRANS_TERMINATED                         85
//#define DIALING									 86
#define SERVICE_NOT_ALLOWED                      87
#define TITLE_TRANS_TYPE						 88
#define EMV_TRY_AGAIN                                89
#define WAIT_FOR_PIN                             90
#define STR_VLP									 91
#define VLP_TRANS_LIMIT							 92
#define LAST_PIN_TRY							 93
#define TRANS_AMOUNT							 94
#define CASHBACK_AMOUNT				 95
#define PBOC_VER				96
#define INITEMV_SYSDATA				97
#define APP_BLOCK	98
#define CARD_READ_TIMEOUT 99
#define CARD_qPBOC_IN 							 100
#define TERM_CVMNOSUPPORT						 101 
#define CARD_qPBOC_OUT 							 102
#define CARD_USEMSD                              103
#define CARD_USEPBOC                             104



//PAYPASS selected mode
#define PAYPASS_SELECTED_MODE_C 0x20


/*******************************************************
鍩烘湰缁撴瀯        2008-03-31
淇敼淇℃伅:

********************************************************/
//1锛�1.1 鍛戒护APDU鏍煎紡
typedef struct
{
   	unsigned char   Command[4]; 
   	unsigned short  Lc;
   	unsigned char   DataIn[300];
   	unsigned short  Le;
	unsigned char EnableCancel;
}APDU_SEND;


//1锛�1.2 搴旂瓟APDU鏍煎紡
typedef struct
{
	unsigned char  ReadCardDataOk;
	unsigned short LenOut; 
   	unsigned char  DataOut[300];
   	unsigned char  SWA;
   	unsigned char  SWB;
}APDU_RESP;


//1.1.3 鍗＄姸鎬�
typedef struct
{
	unsigned char  RxState;
   	unsigned char  RxStateT;
}CARD_STATE;









/*******************************************************
搴旂敤閫夋嫨缁撴瀯        2008-03-31
淇敼淇℃伅:
********************************************************/
//1锛�2锛�1 鍗℃枃浠堕�夋嫨搴旂瓟鏂囦欢鏍煎紡
typedef struct 
{
	unsigned char Type; 
	unsigned char DFNameExist;
	unsigned char DFNameLen;
	unsigned char DFName[16]; 
	unsigned char FCIPropExist;
	unsigned char SFIExist;
	unsigned char SFI; 
	unsigned char LangPreferExist;
	unsigned char LangPreferLen;
	unsigned char LangPrefer[8];
	unsigned char ICTIExist;
	unsigned char ICTI;     //鍙戝崱鏂逛唬鐮佽〃绱㈠紩
	unsigned char AppLabelExist;
	unsigned char AppLabelLen;
	unsigned char AppLabel[16];
	unsigned char PriorityExist;
	unsigned char Priority; 
	unsigned char PDOLExist;
	unsigned char PDOLLen;
	//unsigned char PDOL[252];
	unsigned char PreferNameExist;
	unsigned char PreferNameLen;
	unsigned char PreferName[16];
	unsigned char IssuerDiscretExist;  //鍙戝崱琛岃嚜瀹氫箟鏁版嵁
	unsigned char IssuerDiscretLen;
	//unsigned char IssuerDiscret[254];
	unsigned char LogEntryExist;	
	unsigned char LogEntryLen;
	//unsigned char LogEntry[222];
	unsigned char paypassselectppse61tagexist;
}SELECT_RET;		
//1锛�2锛�2 鍗¤鍗¤褰曞簲绛旀牸寮�
typedef struct 
{
	unsigned char Type;              //1:DDF,2:ADF
	unsigned char DFNameExist;      //0-non exist;1-exist.
	unsigned char DFNameLen;
	unsigned char DFName[16];       //5-16,ADF or DDF name according to Type.
	unsigned char AppLabelExist;
	unsigned char AppLabelLen;
	unsigned char AppLabel[16];
	unsigned char PreferNameExist;
	unsigned char PreferNameLen;
	unsigned char PreferName[16];
	unsigned char PriorityExist;
	unsigned char Priority;         //tag'87'
	unsigned char DirDiscretExist;
	unsigned char DirDiscretLen;
	//unsigned char DirDiscret[254];
}RECORD_PSE;
//1锛�2锛�3 搴旂敤鏍囩缁撴瀯
typedef struct 
{
    unsigned char tradetypevalue;
	unsigned char ASI;               //0-partial match up to the length;1-match exactly
	unsigned char AIDLen;
	unsigned char AID[16];          //5-16
}TERMAPP;


typedef struct 
{
	unsigned char AIDLen;
	unsigned char AID[16];//5-16
	unsigned char AppLabelLen;
	unsigned char AppLabel[16];
	unsigned char PreferNameLen;
	unsigned char PreferName[16];
	unsigned char Priority;
	unsigned char LangPreferLen;
	unsigned char LangPrefer[8];        //2-8
	unsigned char ICTI; //Issuer Code Table Index.lang used for display app list according to ISO8859.but not include Chinese,Korea,etc.
	unsigned char ICTILen;
    unsigned char AidInTermLen;
	unsigned char AidInTerm[16];		//瀵瑰簲鐨勭粓绔殑AID鍜岄暱搴�
	unsigned char KernelIdentifierLen;
	unsigned char KernelIdentifier[8];    //Kernel Identifier   jiguang 20121217
	unsigned char ReqKernelID;
	unsigned char tradetypevalue;
}LISTAPPDATA;


//1锛�2锛�5  搴旂敤鏍囩鏁版嵁
/*
typedef struct {   
	unsigned char AIDLen;
	unsigned char AID[16];//5-16
	unsigned char AppLabelLen;
	unsigned char AppLabel[16];
	unsigned char PreferNameLen;
	unsigned char PreferName[16];
	unsigned char Priority; //tag'87'
	unsigned char LangPreferLen;
	unsigned char LangPrefer[8];//2-8
	unsigned char ICTI; //Issuer Code Table Index.lang used for display app list according to ISO8859.but not include Chinese,Korea,etc.
	unsigned char ICTILen;   
	unsigned char PDOLLen;
	unsigned char PDOL[127];
	unsigned char DirDiscretLen;
	unsigned char DirDiscret[100];
	unsigned char IssuerDiscretLen;
	unsigned char IssuerDiscret[222];   //sxl  
	unsigned char bLocalName;//If display app list using local language considerless of info in card.0-use card info;1-use local language.
	unsigned char AppLocalNameLen;
	unsigned char AppLocalName[16];
	unsigned char AidInTermLen;
	unsigned char AidInTerm[16];		//瀵瑰簲鐨勭粓绔殑AID鍜岄暱搴�
	unsigned char KernelIdentifierLen;
	unsigned char KernelIdentifier[8];    //Kernel Identifier   jiguang 20121217
	unsigned char ReqKernelID;
	
	
	}APPDATA;		//搴旂敤鏁版嵁淇℃伅
*/







//
typedef struct
{
	unsigned char  Tag[3];//Second byte '00' means only first one byte tag.add third byte to make int variable oven aligned.
	unsigned char  Len1; //Len1>Len2: fix len with Len2;Len1<Len2 and Len2!=255: Len1<= len <=Len2; Len2=255: len=Len1+Len2
	unsigned char  Len2;
	unsigned char  bAmt;//0- non numeric;1-numeric;2-compact numric
	unsigned short address;//var address in struct 
	unsigned char  flagM;//'1'--bit0: mandatory;bit1: SDA mandatory; bit2: DDA mandatory;
	unsigned char  bExist;//0-not presented,1-have been existed.	
}DATAELEMENT;


#define RFD_AID



typedef struct
{
	unsigned char  Tag[3];//Second byte '00' means only first one byte tag.add third byte to make int variable oven aligned.
	unsigned char updatecondition;
}PAYPASSTAGBASELIB;



typedef struct
{
    unsigned char tradetypevalue;
    unsigned char AidLen;
    unsigned char Aid[16];//5-16
    unsigned char Asi;  //Application Selection Indicator.0-needn't match exactly(partial match up to the length);1-match exactly
    unsigned char AppVerNum[2];
    unsigned char TacDefault[5];
    unsigned char TacOnline[5];
    unsigned char TacDecline[5];
    unsigned char FloorLimit[4];
    unsigned char Threshold[4];
    unsigned char MaxTargetPercent;
    unsigned char TargetPercent;
    unsigned char TermDDOLLen;
    unsigned char TermDDOL[128];
    unsigned char RandTransSel;      //Weather process the Random Transaction Selection(1-process)
    unsigned char VelocityCheck;     //Weather process the Velocity Checking


    unsigned char StatusCheckSupport;
    unsigned char ZeroAmountCheckAllowed;
    unsigned char ReaderCvmRequiredLimit[6];
    unsigned char ReaderContactlessTransactionLimit[6];
    unsigned char ReaderContactlessFloorLimit[6];
    unsigned char bRiskManDataExist;
    unsigned char RiskManData[8];

}EmvSysIni_STRUCT;


typedef struct 
{
	unsigned char RID[5];
	unsigned char CAPKI;
	unsigned char HashInd;
	unsigned char ArithInd;
	unsigned char ModulLen;
	unsigned char Modul[248];
	unsigned char ExponentLen;
	unsigned char Exponent[3];
	unsigned char CheckSumLen;
	unsigned char CheckSum[20];
	unsigned char ExpireDate[4];	//澶辨晥鏈�  // 鏈夋晥鏈熺殑澶勭悊

}CAPK_STRUCT;

typedef struct
{
	unsigned char TACDenial[5];
	unsigned char TACOnline[5];
	unsigned char TACDefault[5];
}ISSUER_TAC;

//浠庡彂鍗¤鍏挜璇佷功鎭㈠鏁版嵁鐨勬牸寮�
typedef struct
{
	unsigned char DataHead;		//'6A'鎭㈠鏁版嵁澶�
	unsigned char CertFormat;	    //'02'璇佷功鏍煎紡
	unsigned char IssuID[4];		//涓诲笎鍙锋渶宸﹂潰鐨�3-8涓暟(鍙宠ˉF)鍙戝崱琛屾爣璇�
	unsigned char ExpireDate[2];	//璇佷功澶辨晥鏃ユ湡MMYY
	unsigned char CertSerial[3];	//璇佷功搴忓垪鍙�
	unsigned char HashInd;		    //鍝堝笇绠楁硶鏍囪瘑
	unsigned char IPKAlgoInd;	    //鍙戝崱琛屽叕閽ョ畻娉曟爣璇�
	unsigned char IPKLen;		    //鍙戝崱琛屽叕閽ョ殑瀛楄妭闀垮害
	unsigned char IPKExpLen;		//鍙戝崱琛屽叕閽ユ寚鏁扮殑瀛楄妭闀垮害
	unsigned char IPKLeft[212];	//鍙戝崱琛屽叕閽ユ垨鍏挜鏈�宸﹁竟鐨勫瓧鑺侼CA-36涓嶅鍙宠ˉBB
	unsigned char HashResult[20]; //鍝堝笇缁撴灉
	unsigned char DataTrail;		//'BC'鎭㈠鏁版嵁缁撳熬
}IPK_RECOVER;

typedef struct
{
	unsigned char DataHead;//'6A'
	unsigned char CertFormat;//'04'
	unsigned char AppPAN[10];
	unsigned char ExpireDate[2];
	unsigned char CertSerial[3];
	unsigned char HashInd;
	unsigned char ICCPKAlgoInd;
	unsigned char ICCPKLen;
	unsigned char ICCPKExpLen;	
	unsigned char ICCPKLeft[206];//NI-42
	unsigned char HashResult[20];
	unsigned char DataTrail;//'BC'
}ICCPK_RECOVER;

typedef struct 
{
	unsigned char DataHead;//'6A'
	unsigned char DataFormat;//'05'
	unsigned char HashInd;//'01'
	unsigned char ICCDynDataLen;
	unsigned char ICCDynData[223];//LDD	<NIC-25
	unsigned char PadPattern[223];//NIC-LDD-25,padded with 'BB'
	unsigned char HashResult[20];		
	unsigned char DataTrail;//'BC'
}SIGN_DYN_APPDATA_RECOVER;

typedef struct 
{
	unsigned char DataHead;//'6A'
	unsigned char DataFormat;//'03'
	unsigned char HashInd;
	unsigned char DataAuthCode[2];
	unsigned char PadPattern[222];//NI-26
	unsigned char HashResult[20];
	unsigned char DataTrail;//'BC'
}SIGN_STAT_APPDATA_RECOVER;	

typedef struct 
{
	unsigned char RID[5];
	unsigned char CAPKI;
	unsigned char CERTSerial[3];
}IPK_REVOKE;





typedef struct 
{
	unsigned char DataHead;//'6A'
	unsigned char CertFormat;//'04'
	unsigned char AppPAN[10];
	unsigned char ExpireDate[2];
	unsigned char CertSerial[3];
	unsigned char HashInd;
	unsigned char ICCPIN_EPKAlgoInd;
	unsigned char ICCPIN_EPKLen;
	unsigned char ICCPIN_EPKExpLen;	
	unsigned char ICCPIN_EPKLeft[206];//NI-42
	unsigned char HashResult[20];
	unsigned char DataTrail;//'BC'
}ICCPIN_EPK_RECOVER;


typedef struct
{
	unsigned char IACDenial[5];
	unsigned char IACOnline[5];
	unsigned char IACDefault[5];
}Card_TAC;

typedef struct 
{
	unsigned char ICCDynNumLen;
	unsigned char ICCDynNum[8];
	unsigned char CryptInfo;
	unsigned char AppCrypt[8];
	unsigned char HashResult[20];
	unsigned char DSSummary2len;
	unsigned char DSSummary2[16];
	unsigned char DSSummary3len;
	unsigned char DSSummary3[16];
	unsigned char TerminalRelayEntropyCDA[4];
	unsigned char DeviceRelayEntropyCDA[4];
	unsigned char MintimeforRelayAPDUCDA[2];
	unsigned char MaxtimeforRelayAPDUCDA[2];
	unsigned char DevEstTransTimeForRelayCDA[2];
	
	
}ICC_DYN_DATA;


typedef struct
{
	unsigned char AppPriority[16];
	unsigned char AppSeq[16];
	unsigned char seqtype;
	unsigned char SelectedNum;
	unsigned char SelectedResult;
}DISPSEQLISTDATA;


typedef struct
{
	unsigned int  TransAmt;        /* Transaction amount */    //sxl?2022
    unsigned short TransCount;     /* Transaction Sequence Counter. inc by 1 for each trans*/   //sxl?2022
    unsigned char  TransType;        /* Transaction type BCD */
	unsigned char  TSI[2];           /* Transaction Status Information */
    unsigned char  PANLen;
    unsigned char  PAN[10];          /* Primary account No. */
	unsigned char  PANSeq;           /* EMVTest: sequence num with same PAN */
    unsigned char  TransDate[3];     /* Trancaction Date(Form:"YY/MM/DD") */
    unsigned char  TransTime[3];     /* Trancaction Time(Form:"HH/MM/SS") */
} TRANS_LOG;



//paypass Pre-processing struct
typedef struct _PAYPASSPREPROCEFLAG
{
	unsigned char TermCTLEF:1;    //terminal contactless transaction limit exceeded flag
	unsigned char TermCFLEF:1;   //terminal contactless floor limit exceed flag
	unsigned char TermCVMRLEF:1; //terminal CVM required limit exceeded flag
	unsigned char PaywaveCANAI:1;//Contactless Application Not Allowed indicator  jiguang
	unsigned char DRLsupport:1;    //sxl?2022
	unsigned char OndevCTLEF:1;
}PAYPASSPREPROCEFLAG;


typedef struct _DISCRETIONARYITEMITEM
{
	unsigned char errindicationflag;
	unsigned char emvdataflag;
	unsigned char msgdataflag;
}DISCRETIONARYITEMITEM;

typedef struct _OUTPARAMETERSET
{
	unsigned char OutcomeParSet[8];
	unsigned char status;
	unsigned char start;
	unsigned char CVM;
	unsigned char UIRequestOnOutPresent;
	unsigned char UIRequestOnRestartPresent;
	unsigned char DataRecordPresent;
	unsigned char DisDataPresent;
	unsigned char ReceiptinoutParameter;
	unsigned char AIPinoutParameter;
	unsigned char FieldoffinoutParameter;
	unsigned char RemovalTimeoutinoutParameter;
	unsigned char OnlineResDatainoutParameter;
	unsigned char opssendflag;
	struct _DISCRETIONARYITEMITEM discretionaryitem;
	unsigned char selectsucdata;
	unsigned short FCIdatalen;
	unsigned char FCIdata[256];
	unsigned char SelectCombDatalen;
	unsigned char SelectCombData[20];
}OUTPARAMETERSET;



#define USERINTERFACEREQDATASIZE  22
typedef struct _USERINTERFACEREQDATA
{
	unsigned char MessageID;
	unsigned char Status;
	unsigned char HoldTime[3];
	unsigned char LanguagePreference[8];
	unsigned char ValueQualifier;
	unsigned char value[6];
	unsigned char CurrencyCode[2];
	unsigned char LanguagePreferenceLen;
	unsigned char sendMsgFlag;
}USERINTERFACEREQDATA;


typedef struct _ERRORID   //DF8115 - 6
{
	unsigned char L1;
	unsigned char L2;
	unsigned char L3;
	unsigned char SW12[2];
	unsigned char MsgOnError;
}ERRORID;



#define MAXPHONEMESSAGETABLENUM 5
typedef struct
{
	unsigned char PCIIMASK[3];
	unsigned char PCIIVALUE[3];
	unsigned char MESSAGE;
	unsigned char STATUS;
}PHONEMESSAGETABLE;



typedef struct
{
    unsigned int phonemessagetablenum;
	PHONEMESSAGETABLE phonemessagetable[MAXPHONEMESSAGETABLENUM];
}PHONEMESSAGETABLEINFO;



typedef struct
{
	unsigned char tag[4];
	unsigned char updatecondition;
	unsigned short tagdatalen;
	unsigned short tagdatapos;
	
}PAYPASS_DEFTAGDATA;



#define PAYPASSTAGINFOFILE       "paypasstag"
#define PAYPASSTAGDATAFILE       "paypasstad"

#define MAXPAYPASSDEFTAGNUM 30   
#define PAYPASS_DEFTAGINFOLEN 1024
#define PAYPASS_TERMTAGDATABAKLEN 1024
typedef struct
{
    unsigned int PaypassDefTagNum;
	unsigned int tagdatalen;
	PAYPASS_DEFTAGDATA PaypssDefTagData[MAXPAYPASSDEFTAGNUM];
}PAYPASS_DEFTAG;  //30 TERMINFO tag 涓浜庡瘑鐮侀敭鐩樻潵璇存槸澶熺殑锛屾墍鏈夌殑TERMINFO涓嶄細瓒呰繃1K





//TermDataBase
//#define PAYPASSTERMICCTAGEXISTFILE  "ticctagflag"
#define PAYPASS_TAGBASEFILELEN 1024


#define PAYPASS_UPDATECONDITION_ACT  0x10
#define PAYPASS_UPDATECONDITION_RA   0x20
#define PAYPASS_UPDATECONDITION_K    0x40
#define PAYPASS_KNOWNTAG             0x80



#define PAYPASS_DETAG                0x04
#define PAYPASS_TAGVALUEEMPTY        0x08




typedef unsigned char (*core_checkifcardintornlog)(void);
typedef unsigned char (*core_RECOVERAC)(APDU_SEND *apdu_s);
typedef unsigned char (*core_deletetornlog)(void);
typedef void (*core_addtornlog)(uintptr_t AppUnionStructaddr);
typedef void (*core_senduserinterfacerequestdata)(unsigned int step);
typedef void (*core_sendoutparamset)(unsigned int step);
typedef void (*core_sendDisData)(void);
typedef void (*core_sendendapplicationdatarecord)(void);
typedef unsigned char (*core_GetTagUpdateCondition)(unsigned char *tag,unsigned char taglen);
typedef unsigned char (*core_copytornrecorddata)(void);
typedef unsigned char (*core_freetornlogtempdata)(int retCode);
typedef void (*core_promptremovecardsoundled)(void);
typedef void (*core_retrivesavedtornrecord)(void);

//灏嗛渶瑕佽璇佺殑鏁版嵁鏀惧埌鏈�鍓嶉潰锛屽姞蹇鍙栭�熷害
//paypass recovery data
#define TORNRECORDFLAG   "\x55\xaa\x66\xbb"
typedef struct _TornTransactionLogRecordSIZE
{
         unsigned char flag[4];          //\x55\xaa\x55\xaa璇存槑鏈夎褰�
        unsigned char recordseqnum[6];
		unsigned char transdatetime[7];
		unsigned char AmtAuthNum[6];    //tag'9F02' Authorised amount of BCD numeric
        unsigned char AmtOtherNumexist;
		unsigned char AmtOtherNum[6];         //tag'9F03' Other(cashback) amount of BCD numeric
		unsigned char PANLen;
		unsigned char PAN[10];
		unsigned char PANSeqexist;
		unsigned char PANSeq;					//identify card with same pan.
		unsigned char PayPassPreBalanceExist;   //
		unsigned char PayPassPreBalance[6];     //paypass tag '9f50'  jiguang 20121220 add
		unsigned char CDOL1RelatedLen; 
		unsigned char CDOL1RelatedData[256];  //鏈�澶ч暱搴︽殏瀹氳繖涔堝
		unsigned char CVMResult[3];			//tag'9F34' cardholder verification methods perform result
		unsigned char DRDOLRelatedLen; 
		unsigned char DRDOLRelatedData[256];  //鏈�澶ч暱搴︽殏瀹氳繖涔堝
		unsigned char DSSummary1Len;    //8  or 16
		unsigned char DSSummary1[16];
		unsigned char IDSStatus;
		unsigned char InterfaceDeviceSerialNumberExist;
		unsigned char InterfaceDeviceSerialNumber[8];
		unsigned char PDOLRelatedLen;
		unsigned char PDOLRelatedData[256];
		unsigned char ReferenceControlParameter;
		unsigned char TermCapab[3];			  //tag'9F33' terminal capability
		unsigned char CountryCodeexist;
		unsigned char CountryCode[2];		  //tag'9F1A' Terminal country code BCD
		unsigned char TermType;				  //tag'9F35' Terminal type
		unsigned char TVR[5];				  //tag'95'   Terminal Verification Results
        unsigned char TransCateCodeexist;
		unsigned char TransCateCode;          //tag '9F53' Transaction Category Code, Mastercard M/Chip private data.
        unsigned char TransCurcyCodeexist;
		unsigned char TransCurcyCode[2];      //tag'5F2A'
		unsigned char TransDate[3];           //tag'9A'   YYMMDD
		unsigned char TransTime[3];           //tag'9F21',HHMMSS,BCD
		unsigned char TransTypeValue;         //tag'9C',
		unsigned char UnpredictNum[4];        //tag'9F37' Terminal created for each transaction.
		unsigned char CDOL1Len;
		unsigned char CDOL1[256];
}ATTRIBUTE TornTransactionLogRecordSize;

typedef struct _TornTransactionLogRecord
{
        unsigned char flag[4];          //\x55\xaa\x55\xaa璇存槑鏈夎褰�
        unsigned char recordseqnum[6];
		unsigned char transdatetime[7];
		unsigned char AmtAuthNum[6];    //tag'9F02' Authorised amount of BCD numeric
        unsigned char AmtOtherNumexist;
		unsigned char AmtOtherNum[6];         //tag'9F03' Other(cashback) amount of BCD numeric
		unsigned char PANLen;
		unsigned char PAN[10];
		unsigned char PANSeqexist;
		unsigned char PANSeq;					//identify card with same pan.
		unsigned char PayPassPreBalanceExist;   //
		unsigned char PayPassPreBalance[6];     //paypass tag '9f50'  jiguang 20121220 add
		unsigned char CDOL1RelatedLen; 
		unsigned char CDOL1RelatedData[256];  //鏈�澶ч暱搴︽殏瀹氳繖涔堝
		unsigned char CVMResult[3];			//tag'9F34' cardholder verification methods perform result
		unsigned char DRDOLRelatedLen; 
		unsigned char DRDOLRelatedData[256];  //鏈�澶ч暱搴︽殏瀹氳繖涔堝
		unsigned char DSSummary1Len;    //8  or 16
		unsigned char DSSummary1[16];
		unsigned char IDSStatus;
		unsigned char InterfaceDeviceSerialNumberExist;
		unsigned char InterfaceDeviceSerialNumber[8];
		unsigned char PDOLRelatedLen;
		unsigned char PDOLRelatedData[256];
		unsigned char ReferenceControlParameter;
		unsigned char TermCapab[3];			  //tag'9F33' terminal capability
		unsigned char CountryCodeexist;
		unsigned char CountryCode[2];		  //tag'9F1A' Terminal country code BCD
		unsigned char TermType;				  //tag'9F35' Terminal type
		unsigned char TVR[5];				  //tag'95'   Terminal Verification Results
        unsigned char TransCateCodeexist;
		unsigned char TransCateCode;          //tag '9F53' Transaction Category Code, Mastercard M/Chip private data.
        unsigned char TransCurcyCodeexist;
		unsigned char TransCurcyCode[2];      //tag'5F2A'
		unsigned char TransDate[3];           //tag'9A'   YYMMDD
		unsigned char TransTime[3];           //tag'9F21',HHMMSS,BCD
		unsigned char TransTypeValue;         //tag'9C',
		unsigned char UnpredictNum[4];        //tag'9F37' Terminal created for each transaction.
        // add 20170314
        unsigned char TerminalRelayEntropyexist;
        unsigned char TerminalRelayEntropy[4];  //DF8301
        unsigned char DeviceRelayEntropyexist;
		unsigned char DeviceRelayEntropy[4];    //DF8302
		unsigned char MinTimeForRelayexist;
		unsigned char MinTimeForRelay[2];       //DF8303
		unsigned char MaxTimeForRelayexist;
		unsigned char MaxTimeForRelay[2];       //DF8304
		unsigned char DEVEstimatedTimeForRelayexist;
		unsigned char DEVEstimatedTimeForRelay[2]; //DF8305
		unsigned char MeasuredRelayProcessTimeexist;
		unsigned char MeasuredRelayProcessTime[2]; //DF8306
		unsigned char RRPCounterexist;
		unsigned char RRPCounter;                    //DF8307
		unsigned char CDOL1Len;
		unsigned char CDOL1[256];
		unsigned char Reserved[2048 - sizeof(TornTransactionLogRecordSize) - 2];
		unsigned char crc[2];
}ATTRIBUTE TornTransactionLogRecord;




typedef struct
{
	unsigned int index;
	unsigned int exit;
	unsigned char PANLen;
	unsigned char PAN[10];
	unsigned char PANseqexist;
	unsigned char PANseq;
	unsigned char recordseqnum[6];
	unsigned char transdatetime[7];
}TORNTRANSACTIONMAP;



typedef struct _TORNTRANSACTIONMAPLIST
{
	TORNTRANSACTIONMAP TornTransactionInfo;
	struct _TORNTRANSACTIONMAPLIST *next;
}TORNTRANSACTIONMAPLIST;


typedef struct
{
	unsigned char *flashusedflag;
	unsigned int  TornMaxNum;
	unsigned int currentusedindex;
	TORNTRANSACTIONMAPLIST *tornhead;
}TORNTRANSACTIONMAPTOTALINFO;








//=鐢靛瓙鐜伴噾 NowTask ectrade  add for EC-------
#define EMV_EC_CASH				0x2000      					//鐜伴噾鍏呭��
#define EMV_EC_QCACC			 	0x2001      					//鎸囧畾璐︽埛鍦堝瓨
#define EMV_EC_QCACCNO			0x2002      					//闈炴寚瀹氳处鎴峰湀瀛�
#define EMV_READLOG      		0x2003      					//璇绘棩蹇�
#define PAYWAVE_CASH            0x2004
/*******************************************************
瀹氫箟鐨勫彉閲�      2008-03-31
淇敼淇℃伅:

********************************************************/


 

/*******************************************************
鍩烘湰鍑芥暟        2008-03-31
淇敼淇℃伅:
********************************************************/
//2.1.1 瑙ｆ瀽TAG鏁版嵁鐨勯暱搴�



/*******************************************************
搴旂敤閫夋嫨鍑芥暟        2008-03-31
淇敼淇℃伅:
********************************************************/
extern unsigned char Paypass_TornRecordRead(unsigned int index,TornTransactionLogRecord *torntransactionlogrecord);
extern unsigned char Paypass_TornRecordSave(unsigned int index,TornTransactionLogRecord *torntransactionlogrecord);
extern int Paypass_getspectagdata(unsigned char *tag,unsigned char taglen,unsigned char *tagdata,unsigned short *tagdatalen,unsigned char *updatecondition);
extern int Paypass_CheckSpecTag(unsigned char *tag,unsigned char taglen,unsigned short *tagdatalen);

extern unsigned char Paypass_copytornrecorddata(void);
extern unsigned char Paypass_FreeTornLogTempData(void);
extern unsigned char Emv_CheckDateFormat(unsigned char * date);




#define PAYPASSSTEP_S51_11_0    51110
#define PAYPASSSTEP_S51_12_0    51120
#define PAYPASSSTEP_S52_5       5205
#define PAYPASSSTEP_S52_7       5207
#define PAYPASSSTEP_S52_8       5208
#define PAYPASSSTEP_S52_9       5209
#define PAYPASSSTEP_S52_11      5211
#define PAYPASSSTEP_S52_13      5213
#define PAYPASSSTEP_S52_14      5214
#define PAYPASSSTEP_S52_18      5218
#define PAYPASSSTEP_S52_19      5219
#define PAYPASSSTEP_S53_5       5305
#define PAYPASSSTEP_S53_7       5307
#define PAYPASSSTEP_S53_8       5308
#define PAYPASSSTEP_S53_13      5313
#define PAYPASSSTEP_S53_14      5314
#define PAYPASSSTEP_S53_15      5315
#define PAYPASSSTEP_S1_7_0      1070
#define PAYPASSSTEP_S1_7_1      1071
#define PAYPASSSTEP_S1_8_0      1080
#define PAYPASSSTEP_S1_22_0     1220
#define PAYPASSSTEP_S2_3_0      2030
#define PAYPASSSTEP_S2_4_0      2040
#define PAYPASSSTEP_S3_4_0      3040
#define PAYPASSSTEP_S3_5_0      3050
#define PAYPASSSTEP_S3_9_1      3091
#define PAYPASSSTEP_S3_9_2      3092
#define PAYPASSSTEP_S3_12_0     3120
#define PAYPASSSTEP_S3_14_0     3140
#define PAYPASSSTEP_S3_18       3180
#define PAYPASSSTEP_S3_78       3780
#define PAYPASSSTEP_S3_90_1     3901
#define PAYPASSSTEP_S3_90_2     3902

#define PAYPASSSTEP_SR1_5_1     11051
#define PAYPASSSTEP_SR1_5_2     11052
#define PAYPASSSTEP_SR1_12      11120
#define PAYPASSSTEP_SR1_13      11130
#define PAYPASSSTEP_SR1_16      11160
#define PAYPASSSTEP_SR1_17      11170
#define PAYPASSSTEP_SR1_20      11200
#define PAYPASSSTEP_SR1_21      11210

#define PAYPASSSTEP_S3_E41_0  103400
#define PAYPASSSTEP_S4_E4_0   104040
#define PAYPASSSTEP_S4_E5_0   104050
#define PAYPASSSTEP_S4_E6_0   104060
#define PAYPASSSTEP_S4_E10_1  104101
#define PAYPASSSTEP_S4_E10_2  104102
#define PAYPASSSTEP_S4_E13_0  104130
#define PAYPASSSTEP_S4_E15_0  104152
#define PAYPASSSTEP_S4_E27_1  104271
#define PAYPASSSTEP_S4_E27_2  104272
#define PAYPASSSTEP_S5_5        50500
#define PAYPASSSTEP_S5_6        50600
#define PAYPASSSTEP_S5_E17_1  105171
#define PAYPASSSTEP_S5_E17_2  105172
#define PAYPASSSTEP_S5_E27_1  105271
#define PAYPASSSTEP_S5_E27_2  105272
#define PAYPASSSTEP_S5_E31_0  105310
#define PAYPASSSTEP_S6          6000
#define PAYPASSSTEP_S6_10       6100
//#define PAYPASSSTEP_S6_20_1     6201
//#define PAYPASSSTEP_S6_20_2     6202
#define PAYPASSSTEP_S456_23     6230
#define PAYPASSSTEP_S7_8        7080

#define PAYPASSSTEP_S16_E1_0  116010
#define PAYPASSSTEP_S16_E2_0  116020
#define PAYPASSSTEP_S16_E3_0  116030
#define PAYPASSSTEP_CVM_E4_0  600040
#define PAYPASSSTEP_CVM_E8_0  600080

#define PAYPASSSTEP_CVM_E18_0 600180
#define PAYPASSSTEP_CVM_E18_1 600181
#define PAYPASSSTEP_GAC_6     700600
#define PAYPASSSTEP_GAC_11    701100
#define PAYPASSSTEP_GAC_12    701200
#define PAYPASSSTEP_GAC_13    701300
#define PAYPASSSTEP_S78_20_0   78200
#define PAYPASSSTEP_S13_4_0    13040
#define PAYPASSSTEP_S13_5_0    13050
#define PAYPASSSTEP_S13_10_0   13100
#define PAYPASSSTEP_S13_13_0   13130
#define PAYPASSSTEP_S13_12_1   13121
#define PAYPASSSTEP_S13_14_4   13144
#define PAYPASSSTEP_S13_42_0   13420
#define PAYPASSSTEP_S13_44_0   13440
#define PAYPASSSTEP_S13_43_0   13430
#define PAYPASSSTEP_S13_45_0   13450
#define PAYPASSSTEP_S13_32_0   13320
#define PAYPASSSTEP_S13_33_0   13330
#define PAYPASSSTEP_S13_23_0   13230
#define PAYPASSSTEP_S13_25_0   13250
#define PAYPASSSTEP_S13_26_0   13260
#define PAYPASSSTEP_S14_21_1   14211
#define PAYPASSSTEP_S14_33_0   14330
#define PAYPASSSTEP_S14_34_0   14340
#define PAYPASSSTEP_S16_E7     11670
#define PAYPASSSTEP_S10_E5_0  110050
#define PAYPASSSTEP_S10_E6_0  110060
#define PAYPASSSTEP_S10_11    110110
#define PAYPASSSTEP_S10_E14_0 110140
#define PAYPASSSTEP_S10_E16_0 110160
#define PAYPASSSTEP_S10_E18_0 110180
#define PAYPASSSTEP_S10_E50_0 110500
#define PAYPASSSTEP_S10_E52_0 110520
#define PAYPASSSTEP_S10_E53_0 110530
#define PAYPASSSTEP_S9_7      109070
#define PAYPASSSTEP_S9_8      109080
#define PAYPASSSTEP_S9_E9_0   109090
#define PAYPASSSTEP_S9_E10_0  109100
#define PAYPASSSTEP_S9_E14_0  109140
#define PAYPASSSTEP_S9_E15_0  109150
#define PAYPASSSTEP_S9_E17_0  109170
#define PAYPASSSTEP_S10_E19_0 110190
#define PAYPASSSTEP_S10_E20_0 110200
#define PAYPASSSTEP_S10_E22_0 110220
#define PAYPASSSTEP_S10_E24_0 110240
#define PAYPASSSTEP_S9_E27_0  109270
#define PAYPASSSTEP_S11_E46_0 111460
#define PAYPASSSTEP_S11_E90_0 111900
#define PAYPASSSTEP_S11_E95_0 111950
#define PAYPASSSTEP_S11_101    1111010
#define PAYPASSSTEP_S11_E110_0 1111100
#define PAYPASSSTEP_S11_E112_0 1111120
#define PAYPASSSTEP_S11_E113_0 1111130
#define PAYPASSSTEP_S11_E114_1 1111141
#define PAYPASSSTEP_S11_E114_2 1111142
#define PAYPASSSTEP_S11_E114_3 1111143
#define PAYPASSSTEP_S11_E114_4 1111144
#define PAYPASSSTEP_S11_E114_5 1111145
#define PAYPASSSTEP_S11_E115_1 1111151
#define PAYPASSSTEP_S11_E115_2 1111152
#define PAYPASSSTEP_S11_E115_3 1111153
#define PAYPASSSTEP_S11_E115_4 1111154
#define PAYPASSSTEP_S11_E115_5 1111155
#define PAYPASSSTEP_S11_E115_6 1111156
#define PAYPASSSTEP_S11_E115_7 1111157
#define PAYPASSSTEP_S11_E115_8 1111158
#define PAYPASSSTEP_S11_E115_9 1111159
#define PAYPASSSTEP_S11_E119_0 1111190
#define PAYPASSSTEP_S11_E120_1 1111201
#define PAYPASSSTEP_S11_E120_2 1111202
#define PAYPASSSTEP_S12_5      12050
#define PAYPASSSTEP_S12_6      12060
#define PAYPASSSTEP_S15_12     15120
#define PAYPASSSTEP_S15_10     15100

#define PAYPASS_SAVEREQDATA_LANGPREFERENCE 1



#define BLACKLISTSM3_ENABLE_BLACKLISTENABLE  1


#endif

